fix: enforce utf8 resolution limits
This commit is contained in:
@@ -28,10 +28,10 @@ def validate_resolution_input(payload):
|
||||
return None, "value must be a string"
|
||||
if not isinstance(payload.get("reason"), str):
|
||||
return None, "reason must be a string"
|
||||
if len(payload["value"]) > MAX_VALUE_LENGTH:
|
||||
return None, f"value must be at most {MAX_VALUE_LENGTH} characters"
|
||||
if len(payload["reason"]) > MAX_REASON_LENGTH:
|
||||
return None, f"reason must be at most {MAX_REASON_LENGTH} characters"
|
||||
if len(payload["value"].encode("utf-8")) > MAX_VALUE_LENGTH:
|
||||
return None, f"value must be at most {MAX_VALUE_LENGTH} UTF-8 bytes"
|
||||
if len(payload["reason"].encode("utf-8")) > MAX_REASON_LENGTH:
|
||||
return None, f"reason must be at most {MAX_REASON_LENGTH} UTF-8 bytes"
|
||||
|
||||
normalized, error = validate_entry(payload)
|
||||
if error:
|
||||
|
||||
Reference in New Issue
Block a user