diff options
author | Gordan Trevis <GitHub@gordantrevis.me> | 2024-04-16 21:12:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-16 19:12:36 +0000 |
commit | f0d6f140479d24754993b7fcaeb33e07f26e1c88 (patch) | |
tree | 8b861d191f72def055b3796d477aaa3f9b4442a1 /synapse/rest/admin/statistics.py | |
parent | Merge branch 'master' into develop (diff) | |
download | synapse-f0d6f140479d24754993b7fcaeb33e07f26e1c88.tar.xz |
Parse Integer negative value validation (#16920)
Diffstat (limited to 'synapse/rest/admin/statistics.py')
-rw-r--r-- | synapse/rest/admin/statistics.py | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/synapse/rest/admin/statistics.py b/synapse/rest/admin/statistics.py index 832f20402e..dc27a41dd9 100644 --- a/synapse/rest/admin/statistics.py +++ b/synapse/rest/admin/statistics.py @@ -63,38 +63,12 @@ class UserMediaStatisticsRestServlet(RestServlet): ), ) - start = parse_integer(request, "from", default=0) - if start < 0: - raise SynapseError( - HTTPStatus.BAD_REQUEST, - "Query parameter from must be a string representing a positive integer.", - errcode=Codes.INVALID_PARAM, - ) - - limit = parse_integer(request, "limit", default=100) - if limit < 0: - raise SynapseError( - HTTPStatus.BAD_REQUEST, - "Query parameter limit must be a string representing a positive integer.", - errcode=Codes.INVALID_PARAM, - ) + start = parse_integer(request, "from", default=0, negative=False) + limit = parse_integer(request, "limit", default=100, negative=False) + from_ts = parse_integer(request, "from_ts", default=0, negative=False) + until_ts = parse_integer(request, "until_ts", negative=False) - from_ts = parse_integer(request, "from_ts", default=0) - if from_ts < 0: - raise SynapseError( - HTTPStatus.BAD_REQUEST, - "Query parameter from_ts must be a string representing a positive integer.", - errcode=Codes.INVALID_PARAM, - ) - - until_ts = parse_integer(request, "until_ts") if until_ts is not None: - if until_ts < 0: - raise SynapseError( - HTTPStatus.BAD_REQUEST, - "Query parameter until_ts must be a string representing a positive integer.", - errcode=Codes.INVALID_PARAM, - ) if until_ts <= from_ts: raise SynapseError( HTTPStatus.BAD_REQUEST, |