Strip trailing slash on root url in filter

If a trailing slash is defined here, it causes the Whoogle instance to
redirect these element requests back to the home page, causing unwanted
behavior.
main
Ben Busby 2022-04-20 14:55:19 -06:00
parent 5c8be4428b
commit a9b675cd24
No known key found for this signature in database
GPG Key ID: B9B7231E01D924A1
1 changed files with 2 additions and 1 deletions

View File

@ -93,12 +93,13 @@ class Filter:
self.config = config self.config = config
self.mobile = mobile self.mobile = mobile
self.user_key = user_key self.user_key = user_key
self.root_url = root_url
self.page_url = page_url self.page_url = page_url
self.main_divs = ResultSet('') self.main_divs = ResultSet('')
self._elements = 0 self._elements = 0
self._av = set() self._av = set()
self.root_url = root_url[:-1] if root_url.endswith('/') else root_url
def __getitem__(self, name): def __getitem__(self, name):
return getattr(self, name) return getattr(self, name)