special-gallery: scope image prev/next/back to special galleries; add tests

This commit is contained in:
2026-03-27 21:04:18 -04:00
parent 0e48a5d9bd
commit 21a3ab40c5
6 changed files with 145 additions and 63 deletions

View File

@@ -64,15 +64,15 @@ def append_query(url, query_dict):
return url + "?" + urlencode(query_dict)
def gallery_url(path_obj=None, is_dir=False, query_dict=None):
def gallery_url(path_obj=None, is_dir=False, query_dict=None, special=None):
if query_dict is None:
query_dict = {}
if path_obj is None:
base_url = "/gallery/"
base_url = f"/gallery/{special}/" if special is not None else "/gallery/"
else:
path_text = str(path_obj).replace("\\", "/")
base_url = "/gallery/" + path_text
base_url = (f"/gallery/{special}/" if special is not None else "/gallery/") + path_text
if is_dir and not base_url.endswith("/"):
base_url += "/"