Skip to content

fix: resolve chromium-rewritten assets:// urls - #13321

Closed
tiensonqin wants to merge 3 commits into
masterfrom
logseq/fix-assets-url-host-5fe8
Closed

tiensonqin wants to merge 3 commits into
masterfrom
logseq/fix-assets-url-host-5fe8

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1231

Problem

Adding an asset on Linux Desktop logs:

:electron.core/resolve-assets-url Unknown assets url assets://home/...

The assets scheme is registered as a Chromium standard scheme. Chromium therefore rewrites assets:///home/... to assets://home/..., treating the first path segment as the host. The protocol handler stripped assets:// and required the remainder to start with /, so the rewritten URL was rejected.

Change

Extract electron.assets-url/assets-url->fs-path and reconstruct the filesystem path from URL host + pathname:

  • assets://home/user/file.jpg → /home/user/file.jpg
  • assets:///home/user/file.jpg → /home/user/file.jpg
  • Windows drive host form assets://C/logseq__colon/Users/... → /C:/Users/...
  • Windows UNC assets://server/share/file.jpg → //server/share/file.jpg

The unused decode-protected-assets-schema-path helper is removed; colon decoding now happens after reconstruction.

A single-letter host only counts as a rewritten Windows drive when the pathname carries the /logseq__colon/ marker; otherwise on win32 it is still treated as a UNC server (assets://s/share → //s/share), matching the previous handler's assumption.

Tests

Adds focused unit coverage in electron.assets-url-test for the three-slash form, Chromium host form, query/fragment stripping, Windows drive (including rewritten host form), UNC (including single-letter hosts), and the js/URL parse-failure fallback.

Open in Web Open in Cursor 

Link to Devin session: https://app.devin.ai/sessions/f20af14345034f62a799def20dda7895
Open in Devin Desktop: https://app.devin.ai/desktop/session/f20af14345034f62a799def20dda7895?variant=devin
Requested by: @tiensonqin


Devin Review

Copilot AI lite review requested due to automatic review settings September 19, 2026 16:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

cursoragent and others added 3 commits September 23, 2026 17:58
Chromium treats the privileged assets scheme as a standard URL, so
assets:///home/... is rewritten to assets://home/... (host=home).
Reconstruct the filesystem path from host + pathname.

Co-authored-by: Tienson Qin <[email protected]>
The colon-protected drive rewrite now lives in assets-url resolution.

Co-authored-by: Tienson Qin <[email protected]>
A single-letter host is only a rewritten Windows drive when the pathname
carries the /logseq__colon/ drive marker; otherwise on win32 it remains a
UNC server name, matching the previous handler's assumption. Also merge
the two identical path-prefix branches and cover the single-letter UNC
and js/URL-fallback cases.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot force-pushed the logseq/fix-assets-url-host-5fe8 branch from 9b686e4 to 4dba3a3 Compare September 23, 2026 17:58

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +29 to +31
;; Chromium standard-scheme rewrite: assets:///home/foo → assets://home/foo
:else
(str "/" host pathname))))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Capitalized root directories become lowercase

When Chromium rewrites /Users/..., assets-url->fs-path reconstructs /users/... from the canonicalized host. Assets under that case-sensitive root fail to load.

Learn more

Chromium treats this registered standard scheme's first path segment as an authority. Authority canonicalization lowercases ASCII host names before the protocol callback receives the URL, so reconstructing the path from host cannot recover the original casing. The frontend currently emits local paths as three-slash assets URLs in resolve-asset-real-path-url and <make-asset-url.

Example: A graph asset at /Users/Alice/graph/assets/photo.png becomes a request with host users. The handler returns /users/Alice/graph/assets/photo.png, which does not exist on a case-sensitive filesystem.

Recommended fix: Keep filesystem path components out of the authority. Emit assets URLs with a fixed sentinel host and place the complete encoded absolute path in pathname, then teach assets-url->fs-path to remove that sentinel. Update every assets URL producer and add a capitalized-root integration case.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #13898, which covers the same bug more completely. Thanks!

@tiensonqin tiensonqin closed this Nov 20, 2026
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.

Bug: Assets URL built as assets://home/... (missing slash) — resolve-assets-url fails with "Unknown assets url"

3 participants