Skip to content

Sanity-check names and locations people submit - #4

Merged
dbader merged 1 commit into
masterfrom
claude/project-thread-pm5duv
Dec 3, 2026
Merged

dbader merged 1 commit into
masterfrom
claude/project-thread-pm5duv

Conversation

@dbader

@dbader dbader commented Dec 3, 2026

Copy link
Copy Markdown
Member

Requested by Dan · project thread

What

Every location and nickname, from the public form and from admin edits, is now:

  1. Normalized: Unicode NFKC (so fullwidth "Dan" becomes "Dan"), with control and invisible characters dropped (zero-width spaces, right-to-left overrides, bells) and whitespace collapsed. The zero-width joiner is kept so emoji like 👩‍💻 stay whole.
  2. Rejected with a clear message if it:
    • is over the length limit (200 for locations, 50 for nicknames), counted after cleaning
    • contains an email address, because the map is public
    • contains a link (http://, www., or a common TLD like .com)
    • has more than three combining marks stacked on one character ("Zalgo" text)
    • has no letter or digit at all (!!!, 🔥🔥🔥)

Names like "Zoë", "李雷", "Đặng Thị", "@ada_codes" and "👩‍💻 Ada" are still accepted. The link pattern now lives in forms.py, and the admin's "contains a link" flag uses it too.

Testing

uv run pytest: 86 passed, including a new table-driven tests/test_forms.py. Ruff is clean.


Generated by Claude Code

Text is normalized first (NFKC, invisible and control characters
dropped, whitespace collapsed), then rejected if it contains a link, an
email address, more than three stacked combining marks, or no letter or
digit at all. The same rules apply to edits in the admin. Emoji with
zero-width joiners and non-Latin scripts still work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLRZ1bCeX4qyg1QpD6AQFG
@dbader dbader self-assigned this Dec 3, 2026
@dbader
dbader merged commit af0966c into master Dec 3, 2026
1 check 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