Repository navigation
fix: import Windows and HTTPS linked PDF annotations - #13162
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
It changes core import behavior (asset detection + asset creation + per-file import flow) in ways that can affect broader importer correctness beyond the covered cases.
Pull request overview
This PR fixes File→DB import of linked PDF annotations when the PDF is referenced via Windows drive file:// URIs or remote http(s):// URLs, including cases where the only PDF reference lives in hls__ annotation page properties, so imported :logseq.class/Pdf-annotation blocks can reliably bind to a corresponding Asset.
Changes:
- Extend AST asset-link detection to treat
http/httpsComplex links to PDFs as importable PDF assets (in addition tofile). - Create stub external Asset entries for remote
http(s)://PDFs and for external/missingfile://PDFs (including Windows drive URIs) so annotations can still bind. - Add hermetic regression tests for Windows drive URIs, remote HTTPS image links, and HTTPS targets referenced only via
hls__file::/file-path::properties; document the audited case.
File summaries
| File | Description |
|---|---|
| docs/og_import_graph_cases.md | Documents the newly supported Windows/HTTPS linked-PDF annotation import case and references new regression tests. |
| deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs | Adds hermetic tmpdir fixtures and async tests covering Windows file:// URIs, remote HTTPS PDFs, and hls__-property-only PDF targets. |
| deps/graph-parser/src/logseq/graph_parser/exporter.cljs | Updates asset-link URL reconstruction, ensures stub Asset creation for external PDFs, and imports assets derived from hls__ file properties. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
megayu
force-pushed
the
logseq/fix-windows-https-pdf-import-84dc
branch
from
September 7, 2026 07:37
7cf70dc to
0947963
Compare
Create Asset stubs for file:// drive-letter URIs and remote https PDF links during file-to-DB import so Pdf-annotation blocks can bind :logseq.property/asset. Keep missing in-graph relative PDFs ignored. Co-authored-by: Tienson Qin <[email protected]>
Simplify PDF detection and consolidate annotation import coverage. Normalize temporary graph paths on Windows to fix existing test failures.
Map promesa.core/doseq like the root config so export-doc-files lint stops treating annotation-file bindings as unresolved symbols. Co-authored-by: Tienson Qin <[email protected]>
tiensonqin
force-pushed
the
logseq/fix-windows-https-pdf-import-84dc
branch
from
September 8, 2026 02:11
3f58996 to
e416785
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes logseq/db-test#1140 (follow-up to db-test#923 / PR #12815).
Root cause
File→DB import (
import-file-graph-to-db/import-linked-file-pdf-annotations) only treated mldoc Complex links withprotocol=fileas PDF assets, andensure-asset-data!dropped the asset when<get-file-stat>failed.never enteredasset-links.file://D:\…enteredasset-linksand resolved to a drive path, then failed the local stat and created no Asset.hls__pages storefile::/file-path::without importing the page, so a remote PDF referenced only there also produced no Asset.:logseq.class/Pdf-annotationblocks could not bind:logseq.property/asset.Fix
http/httpsComplex PDF links in AST walking, matching the 2个css相关问题—引用格式字体偏大;右侧滚动条背景色 #923 POSIXfile://path.file://(including Windows drive URIs) and remotehttps://PDFs when the file is missing or non-local. Keep the original URL as:logseq.property.asset/external-url.hls__pagefile::/file-path::PDF targets.../assets/missing.pdf) ignored, and do not change the 100MB asset size limit.Tests
Hermetic tmpdir fixtures in
deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs:import-windows-linked-pdf-uri-format—file://D:\assets\LocalDoc.pdfcreates an Asset and binds annotationsimport-remote-https-pdf-annotations—https://example.com/RemoteDoc.pdfimage target creates a bindable Assetimport-remote-https-pdf-annotations-from-hls-file-prop— HTTPSfile::only (no image) still creates and binds the AssetExisting POSIX linked-PDF, uppercase-extension, and missing-relative-PDF tests still pass. Full non-integration exporter suite: 43 tests, 358 assertions, 0 failures.