Fix #5408 - ignore non-int offset in api feed
In the same fashion limit=BAD fallsback to the default value, fallback to zero when offset=WORSE. Also add test coverage verifying limit/offset do the right thing. Signed-off-by: Loic Dachary <loic@dachary.org>
This commit is contained in:
committed by
Christopher Allan Webber
parent
63b5959fd4
commit
7c9af02ab6
@@ -587,7 +587,12 @@ def feed_endpoint(request, outbox=None):
|
||||
outbox = outbox.limit(limit)
|
||||
|
||||
# Offset (default: no offset - first <count> result)
|
||||
outbox = outbox.offset(request.args.get("offset", 0))
|
||||
offset = request.args.get("offset", 0)
|
||||
try:
|
||||
offset = int(offset)
|
||||
except ValueError:
|
||||
offset = 0
|
||||
outbox = outbox.offset(offset)
|
||||
|
||||
# Build feed.
|
||||
for activity in outbox:
|
||||
|
||||
Reference in New Issue
Block a user