Skip to content

Treat sanitizer replacement strings as literal text - #75

Open
muneikh wants to merge 1 commit into
thombashi:masterfrom
muneikh:literal-sanitizer-replacements
Open

muneikh wants to merge 1 commit into
thombashi:masterfrom
muneikh:literal-sanitizer-replacements

Conversation

@muneikh

@muneikh muneikh commented Oct 11, 2026 •

Copy link
Copy Markdown

Sanitizers pass replacement_text and reserved-name handler results directly to re.sub, which interprets backslash escapes as regex replacements. A literal \n becomes a newline, \1 raises an invalid-group error, and a trailing backslash raises re.error.

Use replacement callables so the provided text is inserted literally in both filename/path sanitization and reserved-name handling. Existing path normalization and separator handling remain in place. Eleven regressions cover escapes, group references and trailing backslashes.

Validation: all 11 cases fail before the patch; full Python 3.13 tox suite passes (4,178 passed, 17 skipped). Configured pyright/codespell/Ruff formatting pass. The full-tree Ruff check reports 129 existing diagnostics, unchanged from a clean HEAD archive, with no new diagnostics. Twelve existing runtime/test warnings remain.

This branch has not been deployed

No deployments
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.

1 participant