Skip to content

Bad / corrupted paths for images under Microsoft Windows for --image-export-mode referenced #3617

Description

@clach04

Bug

Using command line tool docling to convert (say) PDF to; markdown, html, or html_split_page results in "bad" paths for Windows. Either '' or URL encoded to %5C.

Looks like this is actually in docling-core https://github.com/docling-project/docling-core/blob/2a78701b3fcee511a3b0d5a6acdf82851d70cfe2/docling_core/types/doc/document.py#L5924 or the rendering https://github.com/docling-project/docling-core/blob/2a78701b3fcee511a3b0d5a6acdf82851d70cfe2/docling_core/transforms/serializer/html.py#L1200 - I'm not clear which

Steps to reproduce

  1. Needs a windows environment :-)

  2. use sample doc and convert:

    docling --no-ocr --to html --image-export-mode referenced  tests\data\pdf\picture_classification.pdf
    

alternatively use Markdown or html.

Seeing

<img src="picture_classification_artifacts%5Cimage_000000_62208f20a02fafcd90d0c99fe51507939b766fd92a2e358cf1d642eee8093a7e.png">

should be

<img src="picture_classification_artifacts/image_000000_62208f20a02fafcd90d0c99fe51507939b766fd92a2e358cf1d642eee8093a7e.png">

%5C is \

trying markdown

docling --no-ocr --to md --image-export-mode referenced  tests\data\pdf\picture_classification.pdf

seems fine but not ideal

![Image](picture_classification_artifacts\image_000000_62208f20a02fafcd90d0c99fe51507939b766fd92a2e358cf1d642eee8093a7e.png)

so using windows path, I believe it is reasonable to use '/' in a Markdown file under Windows.

Docling version

Docling version: 2.102.1
Docling Core version: 2.82.0
Docling IBM Models version: 3.13.3
Docling Parse version: 6.2.0
Python: cpython-312 (3.12.5)
Platform: Windows-11-10.0.22631-SP0

Python version

Python 3.12.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions