fix: interpret path separators per-platform in extract_title_from_path#585
Merged
Conversation
extract_title_from_path only ever receives native local paths: the desktop app and pb CLI pass the opened file's path, and Android copies content URIs to a local cache file before handing the path to the core. Treating a backslash as a separator on unix was therefore speculative generality — and actively wrong, since a backslash is a legal filename character there (a file named "dir\\" got "Untitled" instead of its name). Gate the trailing-backslash check to Windows and split the tests into platform-independent, Windows-only, and unix-only groups. This fixes extracts_title_from_path::case_03, which asserted the Windows answer for a C:\\ path on every platform and failed on macOS.
Owner
|
Thanks for this! Would you be willing to make the tests run on macOS in CI in a followup PR? |
Contributor
Author
|
Sure thing!
The 4 PRs I submitted — that you’ve just merged — make the test suite green, where it previously failed to compile.
There’s some CI work to be done anyway; it seems that we try to build artifacts when contributors update master in their forks, which fails due to missing signing keys, but I’ll address that in a followup.
Thanks for the rapid response to these.
|
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.
extract_title_from_path only ever receives native local paths: the desktop app and pb CLI pass the opened file's path, and Android copies content URIs to a local cache file before handing the path to the core. Treating a backslash as a separator on unix was therefore speculative generality — and actively wrong, since a backslash is a legal filename character there (a file named "dir\" got "Untitled" instead of its name).
Gate the trailing-backslash check to Windows and split the tests into platform-independent, Windows-only, and unix-only groups. This fixes extracts_title_from_path::case_03, which asserted the Windows answer for a C:\ path on every platform and failed on macOS.