Fix Windows file:// URL generation in log viewer#200
Conversation
On Windows, normalizePath() returns backslash paths like D:\path\to\logs. The previous code created invalid URLs like file://D:\path\to\logs. Valid Windows file URLs need: - Three slashes before the drive letter: file:///D:/... - Forward slashes in the path Added path_to_file_url() helper that uses winslash="/" and adds the correct number of slashes per platform. Fixes log viewer showing "no logs" on Windows. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
(Although this may end up causing other viewer problems now that I'm testing more myself. But I do think the issue is Windows file formats) |
The previous commit fixed URL generation but broke loading logs because file:///D:/path was being parsed back to /D:/path (invalid on Windows). Added file_url_to_path() helper that strips the extra leading slash on Windows when converting file:// URLs back to filesystem paths. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Possible fix? |
simonpcouch
left a comment
There was a problem hiding this comment.
Thanks so much! This seems like a reasonable approach.
I'm currently taking a couple weeks to rest but will come back to this in the New Year. :)
|
Rest is awesome! Hope you have a couple of great holiday weeks. Absolutely no rush on this, only reason I brought this up now is because I'm staying home in some miserable winter weather playing with my extra Claude usage 😅 Happy New Year! |
|
Okay, back at it! re:
Just to confirm, how does the code in this PR behave for you on Windows? What are the other viewer problems you're observing? It could be the case that my dev changes introduced several file-path issues on Windows and your changes just fix one of them. |
|
Thanks again! |
On Windows, normalizePath() returns backslash paths like D:\path\to\logs. The previous code created invalid URLs like file://D:\path\to\logs.
Claude Opus 4.5 says:
Valid Windows file URLs need:
Added path_to_file_url() helper that uses winslash="/" and adds the correct number of slashes per platform.
Fixes log viewer showing "no logs" on Windows reported in Issue 199
🤖 Code generated in large part by Claude Code