From 3fe81d8d817cdd81075ca6cd52f72ebaf5550d93 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 21 May 2020 22:43:33 +0100 Subject: [PATCH] No negative page numbers --- posts.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/posts.py b/posts.py index 3d76036a9..de8c95353 100644 --- a/posts.py +++ b/posts.py @@ -2510,6 +2510,8 @@ def createBoxIndexed(recentPostsCache: {}, pageStr = '?page=true' if pageNumber: + if pageNumber < 1: + pageNumber = 1 try: pageStr = '?page=' + str(pageNumber) except BaseException: @@ -2517,15 +2519,15 @@ def createBoxIndexed(recentPostsCache: {}, boxUrl = httpPrefix + '://' + domain + '/users/' + nickname + '/' + boxname boxHeader = { '@context': 'https://www.w3.org/ns/activitystreams', - 'first': boxUrl+'?page=true', + 'first': boxUrl + '?page=true', 'id': boxUrl, - 'last': boxUrl+'?page=true', + 'last': boxUrl + '?page=true', 'totalItems': 0, 'type': 'OrderedCollection' } boxItems = { '@context': 'https://www.w3.org/ns/activitystreams', - 'id': boxUrl+pageStr, + 'id': boxUrl + pageStr, 'orderedItems': [ ], 'partOf': boxUrl,