Repository navigation
Keep stateful encoding output within the filename byte limit - #80
Open
rupayon123 wants to merge 1 commit into
Open
rupayon123 wants to merge 1 commit into
rupayon123 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
With
fs_encoding="iso2022_jp", sanitizing日本語to an 8-byte limit currently returns日本, which encodes to 10 bytes.validate_filenamerejects that result, andvalidate_after_sanitize=Trueraises instead of producing the fitting prefix日.Decoding a byte prefix can discard a stateful codec's closing escape sequence. Trim the decoded suffix until its complete encoding fits the budget. The regression covers ISO-2022-JP, HZ and UTF-7, plus UTF-8/UTF-16 controls, through both sanitizer paths and the validator.
Validation on CPython 3.13/macOS: 4,176 tests pass with 17 existing skips; coverage is 94.3%. Pyright, codespell, formatting, package checks and the docs build pass. Ruff's 129 diagnostics are identical on the pristine base and this patch; the two docs warnings also match baseline. The other Python/OS combinations were not run locally. No dependency or lint configuration changes.