fix(message_router): remove dead shadowed _sanitize_filename delegator - #2743
Merged
vybe merged 1 commit intoSep 14, 2026
Merged
Conversation
message_router.py defined _sanitize_filename twice at module scope. The first definition is a one-line delegator to services.upload_service. sanitize_filename; the second is the full hardened implementation added for Issue Abilityai#487. Python binds the later definition, so the delegator was dead code (pyflakes F811: redefinition of unused _sanitize_filename). Removing it also drops the now-unused sanitize_filename import. No behavior change: the Issue Abilityai#487 implementation was already the one that ran.
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.
What
src/backend/adapters/message_router.pydefines_sanitize_filenametwice at module scope:services.upload_service.sanitize_filename.# Filename sanitization (Issue #487)) is the full hardened implementation (NFKC normalize, basename, safe-char stripping, hidden-dotfile rejection, length cap, collision dedup).Python binds the later definition, so the delegator is dead code.
pyflakesflags it:Fix
Remove the dead delegator. Its only reference to the imported
sanitize_filenamesymbol also disappears, so that name is dropped from theservices.upload_serviceimport.No behavior change — the Issue #487 implementation is already the one that runs; this only deletes the unreachable earlier definition (and the now-unused import).
Verification
pyflakeson the patched file no longer reports the redefinition, andsanitize_filenameis no longer imported-but-unused.+1 / -5, one file.🤖 Generated with Claude Code