Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lukasmasuch
Copy link
Collaborator

@lukasmasuch lukasmasuch commented Feb 4, 2025

Describe your changes

This PR adds support for serving common font file types - ttf, woff2, woff, otf - via the static serving feature.

Testing Plan

  • Added unit tests.
  • Update e2e tests.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@kajarenc
Copy link
Collaborator

kajarenc commented Feb 4, 2025

You can add tests to verify that fonts are served with the correct extensions.
See https://github.com/streamlit/streamlit/blob/develop/lib/tests/streamlit/web/server/app_static_file_handler_test.py

Also in case if it was guessed wrongly by Tornado, or we suspect that it could be wrongly guessed on any OS, you can provide that mapping manually in the initialize_mimetype function in server.py

See this PR #10010 for details.

@sfc-gh-lmasuch sfc-gh-lmasuch added security-assessment-completed Security assessment has been completed for PR change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Feb 17, 2025
@sfc-gh-lmasuch sfc-gh-lmasuch changed the title [WIP] Allow static server for common font types Allow static serving for common font files Feb 17, 2025
@sfc-gh-lmasuch sfc-gh-lmasuch marked this pull request as ready for review February 17, 2025 15:46
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied a small refactoring to make it slightly simpler to add new file extensions

@lukasmasuch lukasmasuch merged commit 20baca3 into develop Feb 17, 2025
32 checks passed
@lukasmasuch lukasmasuch deleted the feature/allow-static-serving-for-font-files branch February 17, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants