Skip to content

Preserve percent-encoded octets in href paths - #2173

Merged
Adam Fourney (afourney) merged 2 commits into
microsoft:mainfrom
Sonai124:fix/preserve-percent-encoded-hrefs
Sep 2, 2026
Merged

Adam Fourney (afourney) merged 2 commits into
microsoft:mainfrom
Sonai124:fix/preserve-percent-encoded-hrefs

Conversation

@Sonai124

Copy link
Copy Markdown
Contributor

Summary

  • preserve syntactically valid %HH octets in href paths without decoding them as UTF-8
  • continue quoting raw Unicode, spaces, and literal or malformed percent signs
  • add HTML converter regression coverage for non-UTF-8 paths and URL escaping compatibility

Fixes #2171

Testing

  • test_html_converter.py: 6 passed on Python 3.10, 3.11, and 3.12
  • full local/CI-equivalent package suite: 307 passed, 34 skipped, 1 Windows-incompatible URI test deselected
  • repository pre-commit hook: passed

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

erejnfnoejjrejnffiwojirkn

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused implementation resolves the reported corruption and is covered by relevant regression and compatibility tests.

Pull request overview

Preserves valid percent-encoded URL path octets during HTML-to-Markdown conversion, preventing non-UTF-8 URL corruption.

Changes:

  • Adds path quoting that preserves valid %HH sequences.
  • Adds regression coverage for encoded octets and escaping compatibility.
File summaries
File Description
packages/markitdown/src/markitdown/converters/_markdownify.py Preserves encoded path octets while quoting other characters.
packages/markitdown/tests/test_html_converter.py Tests non-UTF-8 paths and URL escaping behavior.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@afourney
Adam Fourney (afourney) merged commit 5e1f381 into microsoft:main Sep 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve percent-encoded octets in hrefs to avoid UTF-8 replacement (EUC-JP / Shift-JIS)

4 participants