Skip to content

fix: interpret path separators per-platform in extract_title_from_path#585

Merged
trypsynth merged 1 commit into
trypsynth:masterfrom
mikolysz:path-separators
Jul 8, 2026
Merged

fix: interpret path separators per-platform in extract_title_from_path#585
trypsynth merged 1 commit into
trypsynth:masterfrom
mikolysz:path-separators

Conversation

@mikolysz

@mikolysz mikolysz commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@trypsynth

Copy link
Copy Markdown
Owner

Thanks for this! Would you be willing to make the tests run on macOS in CI in a followup PR?

@trypsynth trypsynth merged commit b43ea38 into trypsynth:master Jul 8, 2026
5 checks passed
@mikolysz

mikolysz commented Jul 8, 2026 via email

Copy link
Copy Markdown
Contributor Author

@mikolysz mikolysz deleted the path-separators branch July 9, 2026 10:28
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.

2 participants