Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't escape plus signs in URLs (#621) #623

Merged
merged 3 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [pull #617] Add MarkdownFileLinks extra (#528)
- [pull #622] Add missing block tags to regex (#620)
- [pull #623] Don't escape plus signs in URLs (#621)


## python-markdown2 2.5.3
Expand Down
2 changes: 0 additions & 2 deletions lib/markdown2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4099,8 +4099,6 @@ def _html_escape_url(
.replace('<', '&lt;')
.replace('>', '&gt;'))
if safe_mode:
if charset != 'base64':
escaped = escaped.replace('+', ' ')
escaped = escaped.replace("'", "&#39;")
return escaped

Expand Down
1 change: 1 addition & 0 deletions test/tm-cases/safe_mode_issue621.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p><a href="https://chromium.googlesource.com/v8/v8.git/+/refs/heads/beta">Chromium</a></p>
1 change: 1 addition & 0 deletions test/tm-cases/safe_mode_issue621.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{'safe_mode': 'escape'}
1 change: 1 addition & 0 deletions test/tm-cases/safe_mode_issue621.text
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Chromium](https://chromium.googlesource.com/v8/v8.git/+/refs/heads/beta)