From 46eb87bc31b7c0e15ed0db1d6aa073e94f992158 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sun, 30 Jun 2024 17:12:31 +1000 Subject: [PATCH] use an regex match rather than just last part of self.url to find search term as something changed and caused the url to be different on the post - not sure when I broke this, or if an upgrade did, but this fixed BUG-127 and BUG-129 (just a special case of 127) --- BUGs | 8 -------- states.py | 8 ++++++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/BUGs b/BUGs index 809c696..747e6f0 100644 --- a/BUGs +++ b/BUGs @@ -19,12 +19,4 @@ BUG-125: when an image is highlighted, then post the contextmenu on a different There is a chance we need to change the document on click to a mouse down (or whatever the context menu uses for default), rather than just fix the highlight -BUG-127: search (via ai search definitely) and then cant sort by oldest/newest, etc. - - also applies to how_many, and then from search I can't go next page without errors - BUG-128: when restarting padb underneath pa, next web requests cause a 500... (need to better catch sql I think, and maybe just retry?) - -BUG-129: still can 'try' to go past end, simple reproduction at the moment 'view stats' for AI matches, click on anyone, click next - -- only in PROD (so with DEV and mich > 10 images, showing only 10 it works) - -BUG-130: Mich has 2 of her refimgs in DEV that match the NOT_WORKING.jpg (the best should stay, and hopefully that is Mich, then other refimgs for the same person need to be excluded) diff --git a/states.py b/states.py index dfda2b7..b7839cc 100644 --- a/states.py +++ b/states.py @@ -116,7 +116,11 @@ class States(PA): self.path_type = 'Bin' elif 'search' in self.url: # okay if we are a search, but came from a view then get last_search_state form prefs and use it - self.orig_search_term = self.url[8:] + m=re.match( '.*search/(.+)$', 'search/AI:dad' ) + if m == None: + SetFELog( message=f"ERROR: DDP messed up, seems we are processing a search, but cant see the search term - is this even possible?" ) + return + self.orig_search_term = m[1] if self.path_type == "View": self.orig_ptype = 'Search' self.orig_url = self.url @@ -263,7 +267,7 @@ class States(PA): if (self.offset + int(self.how_many)) < self.num_entries: self.offset += int(self.how_many) else: - # should be impossible now, but leave jic + # tripping this still SetFELog( message=f"WARNING: next image requested, but would go past end of list? - ignore this" , level="warning", persistent=True, cant_close=False ) if 'current' in request.form: self.current = int(request.form['current'])