diff --git a/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py b/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py index 3f3fef0..9f7614d 100644 --- a/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py +++ b/frontends/etiquette_flask/backend/endpoints/photo_endpoints.py @@ -425,7 +425,9 @@ def get_search_core(): if offset > 0: prev_params = original_params.copy() - prev_params['offset'] = max(0, offset - limit) + prev_offset = max(0, offset - limit) + if prev_offset > 0: + prev_params['offset'] = prev_offset prev_params = helpers.dict_to_params(prev_params) prev_page_url = '/search' + prev_params else: diff --git a/frontends/etiquette_flask/backend/helpers.py b/frontends/etiquette_flask/backend/helpers.py index c78e9b7..f6a214a 100644 --- a/frontends/etiquette_flask/backend/helpers.py +++ b/frontends/etiquette_flask/backend/helpers.py @@ -7,9 +7,8 @@ def dict_to_params(d): if not d: return '' - params = [f'{key}={value}' for (key, value) in d.items() if value] + params = [f'{key}={value}' for (key, value) in d.items()] params = '&'.join(params) - if params: - params = '?' + params + params = '?' + params return params