Skip to content

fix: resolve relative img_path in parsed content lists to absolute paths#628

Open
xor-xe wants to merge 1 commit into
HKUDS:devfrom
xor-xe:fix/624-mineru-image-paths
Open

fix: resolve relative img_path in parsed content lists to absolute paths#628
xor-xe wants to merge 1 commit into
HKUDS:devfrom
xor-xe:fix/624-mineru-image-paths

Conversation

@xor-xe

@xor-xe xor-xe commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

When indexing documents with MinerU + LightRAG, image description generation fails because content-list img_path entries are relative (images/*.png). They are relative to the content-list file inside DeepTutor's parse cache, but RAG-Anything resolves them against its own working directory, so the images are never found.

This PR anchors relative img_path values at the content dir in cache.load_ir, the shared loader all ParseService consumers use. The cached JSON stays relative on disk so cache dirs remain relocatable; absolute paths pass through unchanged.

Related Issues

Module(s) Affected

  • agents
  • api
  • config
  • core
  • knowledge
  • logging
  • services
  • tools
  • utils
  • web (Frontend)
  • docs (Documentation)
  • scripts
  • tests
  • Other: ...

Checklist

  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary).
  • My changes do not introduce any new security vulnerabilities.

Additional Notes

Reproduced the failure path in a unit test: load_ir returned relative img_path values straight from the content-list JSON. Verified with tests/services/parsing and tests/services/rag/test_lightrag_pipeline.py (59 passed, 2 skipped) plus ruff check / ruff format --check on the touched files.

MinerU emits img_path entries like images/x.png relative to the
content-list file inside the parse cache. RAG-Anything resolves them
against its own working directory, so the vision stage cannot open the
images when indexing with LightRAG. Anchor relative img_path values at
the content dir when loading the cached IR; the cached JSON itself stays
relative so cache dirs remain relocatable.

Fixes HKUDS#624
@rickgonzalez

Copy link
Copy Markdown

a scanned explainer from Lenzon - I hope it helps explain this PR https://www.lenzon.ai/viewer/cmrmdcjxr0005zmi33qnbpuf1?voice=google-chirp3

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.

2 participants