Skip to content

Fix three Windows path handling bugs in URI conversion#233

Open
throb wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
throb:fix/windows-uri-path-handling
Open

Fix three Windows path handling bugs in URI conversion#233
throb wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
throb:fix/windows-uri-path-handling

Conversation

@throb
Copy link

@throb throb commented Mar 17, 2026

Summary

  • posix_path_to_uri(): reverse_remap_file_path() was called with the original path argument instead of the processed p, silently discarding any relative-to-absolute path resolution
  • uri_to_posix_path(): drive letter regex only matched uppercase [A-Z], so a URI with a lowercase drive letter retained the leading slash, producing an invalid path
  • posix_path_to_uri(): file URIs were built with host("localhost") producing file://localhost/C:/... which causes parsing mismatches on deserialization. Switched to host("") for the standard file:///C:/... form. The existing code comments (lines 595-599) already note that localhost doesn't work with some readers like ffmpeg

All three are one-line fixes in src/utility/src/helpers.cpp.

Test plan

  • Save a session on Windows with media loaded, close and re-open — media paths should resolve correctly
  • Test with lowercase drive letters (e.g. c:/ vs C:/)
  • Test with path remapping configured (forward_remap_file_path / reverse_remap_file_path)
  • Verify Linux builds are unaffected (two fixes are inside #ifdef _WIN32, the third is platform-neutral)

🤖 Generated with Claude Code

1. posix_path_to_uri: reverse_remap_file_path() was called with the
   original `path` argument instead of the processed `p`, discarding
   any relative-to-absolute path resolution done earlier in the function.

2. uri_to_posix_path: drive letter regex only matched uppercase [A-Z],
   so a URI with a lowercase drive letter (e.g. /c:/Users/...) would
   retain the leading slash, producing an invalid Windows path.

3. posix_path_to_uri: file URIs were built with host("localhost"),
   producing file://localhost/C:/... which can cause parsing mismatches
   on deserialization. The standard form file:///C:/... (empty host) is
   more portable. The existing code comments (lines 595-599) already
   noted that localhost doesn't work with some readers like ffmpeg.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant