Skip to content

Preserve URL marker characters in local filenames - #204

Merged
fabiocaccamo merged 4 commits into
fabiocaccamo:mainfrom
UmutAlisoglu:codex/preserve-local-filename-fragments
Nov 27, 2026
Merged

fabiocaccamo merged 4 commits into
fabiocaccamo:mainfrom
UmutAlisoglu:codex/preserve-local-filename-fragments

Conversation

@UmutAlisoglu

Copy link
Copy Markdown
Contributor

Describe your changes

Local filenames containing # or ? are parsed as URLs, which discards part of the name. For example, changing the extension of Report#draft.txt produces Report.pdf instead of Report#draft.pdf.

Only split query/fragment components for URL inputs. Pass the original input through the filename helpers so URL syntax is handled before filesystem normalization. The regressions cover all five filename helpers and an actual temporary-file rename; HTTP, HTTPS, FTP and file URL controls retain query/fragment stripping.

Related issue

No matching issue or PR found; reproduction above. The older closed #161 addressed HTTP Content-Disposition headers, a separate filename path.

Validation

  • Original source: 3 new regression cases fail; all 4 URL controls pass.
  • Windows / Python 3.14.7: full suite, 309 passed and 3 platform skips; total coverage 98.39% (90% required).
  • All applicable pinned pre-commit hooks pass, including Ruff and mypy.

Checklist before requesting a review

  • I have performed a self-review of my code. (AI-assisted; no human review claimed.)
  • I have added tests for the proposed changes.
  • I have run the tests and there are not errors.

AI-assisted with OpenAI Codex, including investigation, implementation and verification.

@UmutAlisoglu

Copy link
Copy Markdown
Contributor Author

The Codacy report flags one assertion in tests/test_paths.py (line 44) under Bandit's "Avoid Use of Assert Statements" rule. These are pytest test assertions, following the existing test suite's style, rather than runtime validation in the library.

Could this rule be excluded for tests/ in the Codacy configuration, or these test-only findings marked as false positives? I've left the assertions intact so pytest keeps its normal failure introspection.

@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.58%. Comparing base (6166c7e) to head (69cdef3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #204      +/-   ##
==========================================
- Coverage   98.59%   98.58%   -0.01%     
==========================================
  Files          13       13              
  Lines         854      851       -3     
==========================================
- Hits          842      839       -3     
  Misses         12       12              
Flag Coverage Δ
unittests 98.58% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fabiocaccamo
fabiocaccamo merged commit fc2b1f5 into fabiocaccamo:main Nov 27, 2026
32 of 33 checks passed
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