mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-04-15 08:53:30 -07:00
WebHost: Fix: strict suuid converter (#6130)
* WebHost: disallow '=' and whitespace in SUUID and append the correct number of '=' This makes Room IDs unambiguous and avoids breaking if b64decode ever becomes strict. * Tests, WebHost: add SUUID tests * Tests, WebHost: add edge cases to SUUID tests
This commit is contained in:
@@ -71,7 +71,9 @@ CLI(app)
|
||||
|
||||
|
||||
def to_python(value: str) -> uuid.UUID:
|
||||
return uuid.UUID(bytes=base64.urlsafe_b64decode(value + '=='))
|
||||
if "=" in value or any(c.isspace() for c in value):
|
||||
raise ValueError("Invalid UUID format")
|
||||
return uuid.UUID(bytes=base64.urlsafe_b64decode(value + '=' * (-len(value) % 4)))
|
||||
|
||||
|
||||
def to_url(value: uuid.UUID) -> str:
|
||||
|
||||
Reference in New Issue
Block a user