Repository navigation
fix(html): decode relative local image URL paths - #5082
Conversation
Signed-off-by: LimbC-C <[email protected]>
|
✅ DCO Check Passed Thanks @LimbC-C, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit The HTML backend now decodes percent-escaped relative local image paths, so CI safety: no concern found. A maintainer must still approve CI. The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 95fcff94a6. It read the code and did not run it.
I found no defect that should stop the merge. I traced the decoded-path flow in docling/backend/utils/image_resource_loader.py for a local base, and confinement still runs on the decoded path. Encoded .. and encoded // are rejected, and MHTML, remote URLs, and hyperlinks keep their old paths because the new flag is set only when _mhtml_resources is None. The tests cover the defect. The only side effect is that a local file whose name has a raw ? or #, or a literal %XX sequence, no longer loads from an unencoded src. This matches browser behavior, and the PR states it.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
I checked Run CI attempt 2 at The core-test job passed 3,699 tests, with 35 skipped, including all 10 new HTML regressions. The OCR/VLM/PDF/ASR jobs, lint/Tach, and Docs CI also succeeded. The overall Run CI is still failed because of the example job. No code change or rerun was made on the basis of this network traceback. Investigation and this summary were AI-assisted; no independent human review is claimed. |
Signed-off-by: LimbC-C <[email protected]>
|
Synced with Retained the updated upstream picture/caption parent-child structure and CMYK handling. The local HTML image URL-decoding opt-in remains confined to the existing resolver call; upstream tests and the original ten URL regression cases are preserved. Local Windows/Python3.12 validation on this exact head:
Local HTTP fixtures were run with |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the changes since 95fcff94a6 at 3e23453e09. It read the code and did not run it.
The new commits touch none of the PR's files: docling/backend/html_backend.py, docling/backend/utils/image_resource_loader.py, docs/usage/advanced_options.md and tests/test_backend_html.py are unchanged since the earlier review. They only merge unrelated base-branch changes: CI scripts, plans, changelog and Makefile. I found no new point to report.
A maintainer makes the merge decision. This review never approves the pull request.
Signed-off-by: LimbC-C <[email protected]>
EPUB decoded each image src to find its archive entry and passed the decoded path to the HTML backend, so the HTML backend needed a private flag to skip its own URL decoding. Encode the path again instead, so the HTML backend reads every local image src as a URL and decodes it once. Remove the flag. Signed-off-by: Panos Vagenas <[email protected]>
Description
Fixes #5081.
A local HTML page can contain a valid image URL such as
figure%20one.png, but Docling looks for that literal filename and leaves the picture without image data. The same PNG loads through a plain or raw-space filename.Decode the relative URL path once, only for standalone HTML image loading under a local base. Remove its query and fragment before the existing absolute-path and directory-confinement checks. Keep remote URLs, MHTML archive keys, hyperlinks, and other backends' native-path handling unchanged. The shared resolver's new keyword-only option defaults to false. No dependency or lockfile changes.
Checklist
Review evidence
9051777f9e420fa3a37df77425b08f22d0bf5981.DocumentConverter, local PNG writes, pixel/size checks, caption/text order, and Markdown export with embedded image data. No conversion/parser behavior is mocked.%20filename (decode once), an escaped#, query/fragment handling, encoded traversal and absolute/network-path rejection, disabled fetching, and unchanged remote URL paths/queries through a local HTTP server.test_backend_html.py,test_backend_mhtml.py,test_image_resource_loader.py,test_backend_markdown.py): 234 passed, 4 failed, 1 skipped on Windows. The same four existing path assertions fail with the exact original production files; no old test was edited or skipped to hide them. The failures aretest_resolve_relative_path,test_extract_parent_hyperlinks,test_path_traversal_blocked_in_resolve_relative_path, andtest_valid_local_paths_still_work.make SHELL=sh.exe validatewith GNU Make 4.4.1 and Git Bash: 11 applicable hooks passed, 5 inapplicable hooks skipped, including Ruff, ty, Tach, module coverage, license checks, and file-size limits.uv sync --frozen --group dev --all-packages --no-group docs --no-group examples. Python 3.12.14; docling/docling-slim 2.144.0; docling-core 2.104.0. Test HTTP traffic stays local; the process bypasses the Windows system proxy for those server fixtures. No model weights were downloaded or run.No reference data was regenerated. The whole repository/model suite and Linux/macOS runs were not performed. The four Windows baseline failures remain outside this repair.
AI assistance: Codex assisted with investigation, implementation, tests, and this description. No independent human review is claimed.