Skip to content

bug: rich-mode non-PDF images ignore document-relative path resolution #471

@chaoxu

Description

@chaoxu

Summary

Rich-mode non-PDF images appear to ignore document-relative path resolution.

Why this looks wrong

src/render/image-render.ts resolves PDF targets relative to the current document before rendering them, but the non-PDF branch still passes the raw markdown target directly into <img src>.

That means a document like posts/math.md with ![](diagram.png) likely renders diagram.png relative to the app URL rather than posts/diagram.png.

Affected code

  • src/render/image-render.ts
  • src/lib/project-paths.ts

Impact

Rich mode can fail to render ordinary relative images from nested documents even though the project-path helpers already know how to resolve them.

Notes

This came from static audit, not a live UI repro. I did not find any file-to-webview URL bridge elsewhere in the repo that would make the raw path safe.

Related: #437

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions