From eaf4513e643d0d4e17bb43b9e81df70250d83f7a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 4 Sep 2019 12:42:22 +0100 Subject: [PATCH] Get page number --- daemon.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/daemon.py b/daemon.py index ef06d925..3e57936f 100644 --- a/daemon.py +++ b/daemon.py @@ -1967,7 +1967,14 @@ class PubServer(BaseHTTPRequestHandler): # -1 = new post failed # 2 = new post canceled pageNumber=1 - if authorized and '/users/' in self.path and self.path.endswith('?'+postType): + if authorized and '/users/' in self.path and '?'+postType+'?' in self.path: + if '?page=' in in self.path: + pageNumberStr=self.path.split('?page=')[1] + if '?' in pageNumberStr: + pageNumberStr=pageNumberStr.split('?')[0] + if pageNumberStr.isdigit(): + pageNumber=int(pageNumberStr) + self.path=self.path.split('?page=')[0] if ' boundary=' in self.headers['Content-type']: nickname=None nicknameStr=self.path.split('/users/')[1] @@ -2058,11 +2065,6 @@ class PubServer(BaseHTTPRequestHandler): else: filename=None - # get the page number to return to - if fields.get('pageNumber'): - if fields['pageNumber'].isdigit(): - pageNumber=int(fields['pageNumber']) - # send the post if not fields.get('message'): return -1,pageNumber