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)

This commit is contained in:
2024-06-30 17:12:31 +10:00
parent cbea1f09ab
commit 46eb87bc31
2 changed files with 6 additions and 10 deletions

View File

@@ -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'])