Windows: fix pathFromURL and implement Reveal Source#257
Merged
tedwaine merged 2 commits intoMay 27, 2026
Merged
Conversation
pathFromURL on Windows returned url.toString() - the full file URL
string with scheme, authority and URL-encoded reserved characters.
That string then flowed unchanged through every QML caller to
user-visible text (window title, clipboard, dialog text fields) and
to external process arguments (ffmpeg), producing artefacts like
"file:///Z:/path/foo.xst" in the window title and ffmpeg output
filenames such as "file:///Z:/foo.%23%23%23%23.%04d.jpg".
Replace the pathFromURL Windows branch with a delegation to
QUrl::toLocalFile() after patching the one URL shape Qt can't handle
on its own: xstudio constructs URLs as file://localhost//<drive>:/...,
which toLocalFile() interprets as a UNC \\localhost\<drive>:\... path.
Strip the localhost authority and collapse the doubled leading slash;
Qt's conversion then yields a clean drive-letter path. Standard file
URLs and real UNC URLs are handled by toLocalFile() unchanged.
Implement the previously-empty Windows branch of showURIS using
explorer.exe /select,<native-path>, calling pathFromURL to obtain the
clean drive-letter path. explorer.exe /select takes a single target
per invocation (unlike macOS open -R and Linux ShowItems, which
accept a list), so the Windows branch reveals only the first URL in
the input.
The pathFromURL non-Windows branch (`return url.path().replace("//",
"/")`) is unchanged; Linux and macOS behaviour is preserved.
Signed-off-by: Ben de Luca <bdeluca@gmail.com>
choose_output had three intended branches over the regex matches:
- filename contains a numeric frame range (foo.0001.jpg): replace
digits with #### and set audio output to <prefix>.aiff
- filename has neither a frame number nor hashes (foo.jpg): inject
#### and set audio output to <prefix>.aiff
- filename already contains hashes (foo.####.jpg): no branch
The third case had no handler. Previously this was masked because Qt
URL-encoded the # characters to %23 when serializing the file dialog
URL, and the with_hashes regex matched the literal # character only.
The encoded form failed the regex, the third branch was indistin-
guishable from the second, and audio output auto-filled by accident
via the !with_hashes branch.
With the previous commit applying QUrl::toLocalFile() in pathFromURL
the path is fully decoded before the regex runs, with_hashes
correctly matches the literal ####, and the missing case surfaces as
audio output not auto-filling when the user types ####. Add the
explicit `else if (with_hashes)` branch: keep the path as the user
wrote it and set the audio filename via the same ext[1] + "aiff"
prefix used by the other two branches.
Signed-off-by: Ben de Luca <bdeluca@gmail.com>
8bf55d6 to
359bce6
Compare
2bd9ef1
into
AcademySoftwareFoundation:develop
2 of 3 checks passed
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.
Summary
helpers.pathFromURLon Windows returnedurl.toString()— the full file URL string with scheme, authority and URL-encoded reserved characters. That string flowed unchanged through every QML caller to user-visible text (window title, clipboard, dialog text fields) and to external process arguments (ffmpeg), producing artefacts likefile:///Z:/path/foo.xstin the window title and ffmpeg output filenames such asfile:///Z:/foo.%23%23%23%23.%04d.jpg.Commit 1 replaces the
pathFromURLWindows branch with a delegation toQUrl::toLocalFile()after patching the one URL shape Qt can't handle on its own (xstudio constructs URLs asfile://localhost//<drive>:/..., whichtoLocalFile()interprets as a UNC\\localhost\<drive>:\...path; the Windows branch strips the localhost authority and collapses the doubled leading slash before delegating). It also implements the previously-empty Windows branch ofshowURISusingexplorer.exe /select.Commit 2 adds an explicit branch in
VideoRendererDialog.choose_outputfor the case where the user types a filename that already contains####. This case was previously masked because Qt URL-encoded the#characters and thewith_hashesregex couldn't detect them; oncepathFromURLreturns a decoded path, the gap surfaces as the audio output filename no longer auto-filling.Linux / macOS impact
None. The
pathFromURLnon-Windows branch (return url.path().replace("//", "/")) is untouched.