Skip to content

fix: validate color-code markers against guild regex - #773

Merged
darbyjack merged 4 commits into
masterfrom
fix/raw-name-regex-validation
Jul 12, 2026
Merged

fix: validate color-code markers against guild regex#773
darbyjack merged 4 commits into
masterfrom
fix/raw-name-regex-validation

Conversation

@darbyjack

@darbyjack darbyjack commented Jul 12, 2026

Copy link
Copy Markdown
Member

Summary

Fix guild name and prefix validation when guild.requirements.include-color-codes is disabled.

The setting continues to control whether valid color-code sequences count toward the configured length, but the raw color-code marker must still be permitted by the configured regex.

Root cause

The previous validation translated and stripped color codes before applying the regex. As a result, an input such as &aGuild became Guild before validation, allowing & to bypass a regex that intentionally excluded it.

Changes

  • add a shared GuildInputValidator for guild names and prefixes
  • strip valid color-code sequences only for visible-length validation when configured
  • separately verify that alternate (&) and section-sign (§) color-code markers are accepted by the configured regex
  • use the shared validation for guild creation, renaming, and prefix changes
  • preserve the existing behavior when color codes are configured to count toward length

Local validation

Compiled the exact validator implementation locally with lightweight stubs and ran a standalone assertion harness covering:

  • plain names
  • forbidden and allowed & color codes
  • color codes counted versus excluded from length
  • multiple formatting codes
  • literal ampersands
  • prefix validation
  • section-sign color codes
  • invalid visible characters

Fixes #266

@darbyjack
darbyjack marked this pull request as ready for review July 12, 2026 02:38
@darbyjack
darbyjack merged commit ee11c6f into master Jul 12, 2026
1 check passed
@darbyjack
darbyjack deleted the fix/raw-name-regex-validation branch July 12, 2026 02:38
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.

If include-color-codes: false is set in configs, regex doesn't check & character.

1 participant