Problem
The macOS/Linux file-association path handling in cdisplayagain.py incorrectly slices file:// arguments:
if raw.startswith("file://"):
raw = raw[7]
raw[7] returns one character, not the path after the URI prefix. A file opened through an association that supplies a file:// URI can therefore become a one-character path and fail with “File not found”.
Fix
- Parse file URIs with
urllib.parse.urlparse/unquote, including percent-encoded spaces and non-ASCII paths.
- Preserve normal filesystem paths and command-line paths unchanged.
- Handle
file:///absolute/path, rather than assuming a simple string slice.
Tests
Add tests for:
- Plain absolute path.
file:///tmp/My%20Comic.cbz.
- A path containing Unicode characters.
- A non-file URI or malformed URI with an actionable error.
The regression test must fail against the current raw[7] implementation.
Done criteria
- A CBZ/CBR opened through a desktop association resolves to the complete filesystem path.
- Existing direct CLI path handling remains unchanged.
- Lint and the full test suite pass.
Problem
The macOS/Linux file-association path handling in
cdisplayagain.pyincorrectly slicesfile://arguments:raw[7]returns one character, not the path after the URI prefix. A file opened through an association that supplies afile://URI can therefore become a one-character path and fail with “File not found”.Fix
urllib.parse.urlparse/unquote, including percent-encoded spaces and non-ASCII paths.file:///absolute/path, rather than assuming a simple string slice.Tests
Add tests for:
file:///tmp/My%20Comic.cbz.The regression test must fail against the current
raw[7]implementation.Done criteria