From e3cf7d9ee697df5665b709738f39d2f0cebae277 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Tue, 4 Sep 2018 21:25:25 +0200 Subject: [PATCH] Bugfix in the collection for the last empty page --- activitypub.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/activitypub.py b/activitypub.py index 6aa3be5..c7425dd 100644 --- a/activitypub.py +++ b/activitypub.py @@ -646,6 +646,16 @@ def build_ordered_collection( data = list(col.find(q, limit=limit).sort("_id", -1)) if not data: + # Returns an empty page if there's a cursor + if cursor: + return { + "@context": ap.COLLECTION_CTX, + "type": ap.ActivityType.ORDERED_COLLECTION_PAGE.value, + "id": BASE_URL + "/" + col_name + "?cursor=" + cursor, + "partOf": BASE_URL + "/" + col_name, + "totalItems": 0, + "oredredItems": [], + } return { "@context": ap.COLLECTION_CTX, "id": BASE_URL + "/" + col_name,