Only drop trailing blank lines when cleaning URLs - #1046
Merged
jacebrowning merged 1 commit intoJul 26, 2026
Conversation
The trailing-blank-line cleanup replaced every '/_.' in the URL with '.', not just the one at the end of the path. A URL like /images/vince/a/_.b/c-d.png, where '_' starts a middle text line whose content begins with a dot, was collapsed to /images/vince/a.b/c-d.png, merging two separate text lines and redirecting to the wrong image. Anchor the substitution to the extension at the end of the path so only genuinely trailing blank lines are removed. Adds app/tests/test_utils_urls.py covering both the dropped trailing blanks and the preserved mid-path blank line.
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.
Closes #871
clean()replaced every/_.in the URL with., not just the trailing one, so/images/vince/a/_.b/c-d.png(where the second line is a blank line followed by text starting with a dot) collapsed to/images/vince/a.b/c-d.pngand redirected to the wrong image. Anchoring the substitution to the extension at the end of the path removes only genuinely trailing blank lines.