mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +00:00
anchor_value: Fix parsing of large anchor values.
This handles the conditions when anchor values are larger than LARGER_THAN_MAX_MESSAGE_ID by clamping them down to it. Also added tests for the function parse_anchor_value. Fixes #16768.
This commit is contained in:
committed by
Alex Vandiver
parent
4911bc3c4d
commit
cbb7fb8ac0
@@ -839,6 +839,8 @@ def parse_anchor_value(anchor_val: Optional[str],
|
||||
anchor = int(anchor_val)
|
||||
if anchor < 0:
|
||||
return 0
|
||||
elif anchor > LARGER_THAN_MAX_MESSAGE_ID:
|
||||
return LARGER_THAN_MAX_MESSAGE_ID
|
||||
return anchor
|
||||
except ValueError:
|
||||
raise JsonableError(_("Invalid anchor"))
|
||||
|
||||
Reference in New Issue
Block a user