Skip to content

fix(markdown): resolve uploaded local image references#1159

Open
wolfkill wants to merge 1 commit into
Tencent:mainfrom
wolfkill:feature/markdown-local-images
Open

fix(markdown): resolve uploaded local image references#1159
wolfkill wants to merge 1 commit into
Tencent:mainfrom
wolfkill:feature/markdown-local-images

Conversation

@wolfkill
Copy link
Copy Markdown
Contributor

@wolfkill wolfkill commented May 7, 2026

Summary

  • resolve Markdown local image references against images already uploaded to the same knowledge base
  • keep folder upload order image-first so Markdown parsing can find referenced assets
  • align frontend/backend/docparser support for additional image formats including svg/webp/bmp/tiff

Fixes #952

Testing

  • CGO_LDFLAGS="-lc++" go test ./internal/application/service -run "Test(IsValidFileTypeAcceptsSupportedImageFormats|ExtractMarkdownLocalImageRefs|NormalizeMarkdownLocalImagePathSkipsUnsafeRefs|MimeTypeForImageFileUsesExtension|AttachMarkdownLocalImagesUsesUploadedImageKnowledge)" -count=1
  • CGO_LDFLAGS="-lc++" go test ./internal/application/repository -run TestListKnowledgeByFileNames -count=1
  • CGO_LDFLAGS="-lc++" go test ./internal/infrastructure/docparser -run "TestResolveAndStore_LocalImageRefFromReadResult|TestResolveAndStore_MultipleFormats" -count=1
  • npm run build-only
  • Local service e2e: started the backend against local Postgres/DocReader, uploaded an image and Markdown via HTTP API, and verified the Markdown chunk rewrote images/logo.svg to a local://...svg storage URL

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.

[Feature]: 支持解析 markdown 文件中的本地图片路径

1 participant