Skip to content

fix: treat Windows drive-letter paths as local files - #541

Merged
snshn merged 1 commit into
Y2Z:masterfrom
b84330808:fix-windows-drive-letter-target
Oct 24, 2026
Merged

snshn merged 1 commit into
Y2Z:masterfrom
b84330808:fix-windows-drive-letter-target

Conversation

@b84330808

Copy link
Copy Markdown
Contributor

On Windows, passing a full path as the target fails:

> monolith C:\Users\me\Downloads\page.html
Error: unsupported target URL scheme "c"

Relative paths and file:///C:/... URLs work. The cause is that Url::parse("C:\...") succeeds and returns a URL with the one-letter scheme c, so create_monolithic_document() never reaches the filesystem-path fallback. -b/--base-url with a drive path has the same problem; there the assets end up as empty data URLs. The GUI's Browse button fills the target field with path.display(), so it looks like it hits this on Windows too.

This adds url::is_windows_drive_path() and checks it before accepting a parsed URL for the target and the base URL, so drive paths go through the existing filesystem branch.

Tests: a CLI test that passes an absolute target path (on the windows-latest CI job that's a C:\... path, which fails without the fix), plus unit tests for the helper.

I used Claude Code to write this change.

`Url::parse("C:\dir\page.html")` succeeds with the one-letter scheme "c",
so passing an absolute Windows path as the target failed with
`unsupported target URL scheme "c"` before the filesystem fallback ran.
The same happened to `-b`/`--base-url`, which turned assets into empty
data URLs. Check for a drive-letter path before accepting the parsed URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@snshn
snshn requested a balanced review from Copilot October 24, 2026 16:51

Copilot AI left a comment

Copy link
Copy Markdown

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 insufficient remaining quota.

@snshn

snshn commented Oct 24, 2026

Copy link
Copy Markdown
Member

Hi there Wei-Lun Li, thank you for the PR!

Very good catch, I'll get it merged ASAP to be shipped with the next release.

And I've used Claude to rewrite probably close to half of this program by now, great instrument!

@snshn
snshn merged commit 0c1a768 into Y2Z:master Oct 24, 2026
4 checks passed
@b84330808

Copy link
Copy Markdown
Contributor Author

Thanks for the quick merge! Glad it's useful.

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.

3 participants