Skip to content

fix(images): complete JATS file URI figure loading - #5017

Merged
ceberam merged 2 commits into
docling-project:mainfrom
bushidapengyou-cell:fix/jats-file-uri-follow-up
Nov 10, 2026
Merged

ceberam merged 2 commits into
docling-project:mainfrom
bushidapengyou-cell:fix/jats-file-uri-follow-up

Conversation

@bushidapengyou-cell

@bushidapengyou-cell bushidapengyou-cell commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #5016. Follow-up to #4912 and the JATS work identified by @taran-dev4u in #4921.

Support local file URI sources in JATS, reject root-only JATS file URIs and non-localhost authorities outside Windows, and preserve article content when figure decoding raises OSError. Fetch permissions and directory confinement remain unchanged.

The separate Makefile commit aligns the line limit with the existing CI hook. It is independent of the image fix and can be split out if preferred.

Checklist:

  • Documentation updated.
  • Regression tests added.

Review evidence:

Verified image pixels, caption links, body ownership/order, and embedded Markdown export. No reference data changed.

Linux/Python 3.10: 333 passed, 3 skipped, including POSIX authority regressions:

PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 NO_PROXY='*' uv run --no-sync python -m coverage run --branch --source=docling.backend.xml.jats_backend,docling.backend.utils.image_resource_loader -m pytest -p no:cacheprovider -o addopts= tests/test_image_resource_loader.py tests/test_backend_jats.py tests/test_backend_jats_sub_articles.py tests/test_backend_jats_images.py tests/test_image_resource_file_uri.py tests/test_backend_markdown.py tests/test_backend_html.py tests/test_check_skill_routes.py -q --tb=short

UV_NO_SYNC=1 make check
UV_NO_SYNC=1 make validate

Both Make targets passed; non-blocking ty diagnostics remain.

Local Windows/Python 3.12: 320 passed, 4 failed, 5 skipped, with process-scoped PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 and NO_PROXY=*:

uv run --no-sync pytest -p no:cacheprovider -o addopts= tests/test_image_resource_loader.py tests/test_backend_jats.py tests/test_backend_jats_sub_articles.py tests/test_backend_jats_images.py tests/test_image_resource_file_uri.py tests/test_backend_markdown.py tests/test_backend_html.py -q --tb=short

The same 4 HTML path assertion failures reproduce on the base. These are local results; full online CI awaits maintainer action. macOS was not tested.

@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @bushidapengyou-cell, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@bushidapengyou-cell bushidapengyou-cell changed the title Fix/jats file uri follow up fix(images): complete JATS file URI figure loading Oct 26, 2026
@github-actions github-actions Bot added ai:ci-needs-care AI triage: check CI-safety findings before you approve CI bug Something isn't working documentation Improvements or additions to documentation tests issue related to changes needed in the tests xml issue related to supported schema-specific XML formats labels Oct 26, 2026
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit 54413dd705. The analysis read the diff only. It did not run code from this pull request.

This pull request enables local file:// URI source paths for JATS figure image loading. It also rejects non-localhost file URI authorities on non-Windows platforms.

CI safety: needs maintainer care before you approve CI.

  • Makefile: changes local and CI commands
3 related pull request(s) in the same code
PR State Signal Assessment
#5082 open changes the same code related: PR 5082 adds URL path decoding for local HTML images, while this pull request adds JATS file URI loading and authority checks.
#4921 closed referenced as #4921 related: PR 4921 is a closed pull request that attempted an alternative solution for resolving file URI base paths in JATS.
#4912 merged referenced as #4912 related: PR 4912 added initial file URI support to ImageResourceLoader, which this pull request refactors and extends to the JATS backend.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@github-actions github-actions Bot 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.

AI first review (advisory): no blocker found

This review covers the full diff at db3bbb8813. It read the code and did not run it.

The logic changes in _load_figure_image and normalize_local_base_path are correct and well-tested. The only merge blocker is the PR title, which does not follow the fix(...): conventional-commit format that Mergify requires. No code defects were found.

A maintainer makes the merge decision. This review never approves the pull request.

Comment thread docling/backend/xml/jats_backend.py Resolved
@github-actions github-actions Bot added the ai:review-lgtm AI first review found no blocker or major issue (advisory) label Oct 26, 2026
@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
docling/backend/utils/image_resource_loader.py 66.66% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@bushidapengyou-cell

Copy link
Copy Markdown
Contributor Author

The two lines that aren’t covered are part of the Windows-only UNC authority branch. Linux CI covers the POSIX rejection branch, and I checked the Windows UNC path locally since the repo’s online Windows job gets skipped for this PR. I didn’t add any artificial coverage pragma.

@PeterStaar-IBM

Copy link
Copy Markdown
Member

Hi @bushidapengyou-cell, thank you for this pull request.

It has a merge conflict with main. Please rebase your branch on the latest main and resolve the conflict:

git fetch upstream
git rebase upstream/main
# resolve the conflicts, then:
git push --force-with-lease

We can continue with the review and CI after that.

@PeterStaar-IBM PeterStaar-IBM added image issue related to image input (PNG, TIFF, JPEG, ...) jats issue related to JATS XML backend labels Nov 6, 2026
Signed-off-by: 苍穹外卖-01 <2046083414@qq.com>
Signed-off-by: 苍穹外卖-01 <2046083414@qq.com>
@bushidapengyou-cell
bushidapengyou-cell force-pushed the fix/jats-file-uri-follow-up branch from db3bbb8 to 54413dd Compare November 8, 2026 06:23
@github-actions github-actions Bot added ai:ci-needs-care AI triage: check CI-safety findings before you approve CI and removed ai:ci-needs-care AI triage: check CI-safety findings before you approve CI ai:review-lgtm AI first review found no blocker or major issue (advisory) labels Nov 8, 2026
@bushidapengyou-cell

Copy link
Copy Markdown
Contributor Author

So basically, I rebased onto the latest main and sorted out the conflict. The new head is 54413dd.

Locally on Linux/Python 3.10, I got 411 passed and 3 skipped, and both make check and make validate passed. I also removed that redundant JATS OSError catch, since the shared loader handles it now.

Full CI and Docs CI are just waiting on maintainer approval.

@ceberam ceberam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All good! 🚀

Comment thread docling/backend/xml/jats_backend.py Resolved
@ceberam
ceberam merged commit d642657 into docling-project:main Nov 10, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-needs-care AI triage: check CI-safety findings before you approve CI bug Something isn't working documentation Improvements or additions to documentation image issue related to image input (PNG, TIFF, JPEG, ...) jats issue related to JATS XML backend tests issue related to changes needed in the tests xml issue related to supported schema-specific XML formats

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JATS skips figure images with a file URI source

3 participants