Repository navigation
fix: escape file names once on the HTML index pages - #2343
Merged
Merged
Conversation
Member
|
Thanks for this. I would rather not change templite, since it is unaware of the meaning of its templates. So a smaller fix would be better. |
html.py stored escape(filename) in IndexItem and index.html applied the escape filter again, so a file named a&b.py was listed on the file, function and class index pages as a&b.py. Store the raw name and let the template escape it.
Thanatos9404
force-pushed
the
templite-autoescape
branch
from
October 22, 2026 12:57
b209569 to
f3c6f21
Compare
Contributor
Author
|
That makes sense. I've switched the PR to the small fix: html.py now stores the raw file name and the template's |
nedbat
added a commit
that referenced
this pull request
Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The file, function and class index pages escaped file names twice: html.py stored
escape(filename)inIndexItemand index.html applied theescapefilter again, soa&b.pywas listed asa&b.py.html.py now stores the raw name and the template's
escapefilter does the escaping, with no change to Templite. The new test checks the file and function index pages and fails on main. Tested with tests/test_html.py and tests/test_templite.py, ruff, pylint and mypy.