fix(filters): match multi-word character ids in include/exclude - #696
Open
DamianZamolski wants to merge 2 commits into
Open
fix(filters): match multi-word character ids in include/exclude#696DamianZamolski wants to merge 2 commits into
DamianZamolski wants to merge 2 commits into
Conversation
name_to_id underscored spaces, but official ids have no separator (snakecharmer, not snake_charmer), so include/exclude silently matched nothing for multi-word characters. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move name_to_id to script_json so it is importable without the Django app registry (tests.settings is empty by design), then add unit tests for the space/apostrophe/case normalisation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
The include/exclude character filters silently match nothing for any multi-word character.
Example: excluding
Snake Charmer(URL?exclude=Snake+Charmer) still returns scripts containing the Snake Charmer.Cause
name_to_id()inscripts/filters.pyreplaced spaces with underscores:But official character ids carry no separator (
snakecharmer), socontent__contains=[{"id": "snake_charmer"}]never matches. Single-word characters (e.g.mutant) worked only because they have no space.Fix
Strip the space instead of underscoring it, so
Snake Charmer->snakecharmer.Verified against
dev/characters.json: all 172 official character ids match^[a-z0-9]+$(no spaces, underscores, or hyphens), so removing spaces is safe and correct for both include and exclude.🤖 Generated with Claude Code