Skip to content

Commit

Permalink
Even more permissive checks for IGN validity
Browse files Browse the repository at this point in the history
  • Loading branch information
Amund211 committed Sep 25, 2023
1 parent 3851e61 commit 7035a65
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/prism/overlay/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ def valid_username(username: str) -> bool:
"""Return True if username is a valid Minecraft username"""
# https://help.minecraft.net/hc/en-us/articles/4408950195341-Minecraft-Java-Edition-Username-VS-Gamertag-FAQ#h_01GE5JWW0210X02JZN2FP9CREC # noqa: E501
# Must have 3-16 characters
# NOTE: We allow [1, 20] because of some illegal accounts existing
if len(username) < 1 or len(username) > 20:
# NOTE: We allow [1, 25] because of some illegal accounts existing
# This is what the uuid api does (2023-09-25)
if len(username) < 1 or len(username) > 25:
logger.debug(f"Playername {username!r} has invalid length")
return False

Expand Down
2 changes: 2 additions & 0 deletions tests/prism/overlay/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def test_strip_until_raises(line: str, until: str) -> None:
("_a_b_c_", True),
("a_b_c", True),
("MyVeryVeryLongIGN", True),
("MyVeryVeryVeryVeryLongIGN", True),
("MyVeryVeryVeryVeryLongIGN2", False),
("A", True),
("-", False),
("my-ign", False),
Expand Down

0 comments on commit 7035a65

Please sign in to comment.