restreamer: Don't 500 on bad timestamps in chat endpoint

pull/316/head
Mike Lang 2 years ago
parent 8e314eea94
commit 36be1bc01a

@ -458,8 +458,11 @@ def get_chat_messages(channel):
start, end: Required. The start and end times. start, end: Required. The start and end times.
Must be in ISO 8601 format (ie. yyyy-mm-ddTHH:MM:SS) and UTC. Must be in ISO 8601 format (ie. yyyy-mm-ddTHH:MM:SS) and UTC.
""" """
try:
start = dateutil.parse_utc_only(request.args['start']) start = dateutil.parse_utc_only(request.args['start'])
end = dateutil.parse_utc_only(request.args['end']) end = dateutil.parse_utc_only(request.args['end'])
except ValueError:
return "Invalid timestamp", 400
if end <= start: if end <= start:
return "End must be after start", 400 return "End must be after start", 400

Loading…
Cancel
Save