From cc5f15eeaa434af3149ee806203d661d9ddb4dcb Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 5 Dec 2024 04:21:06 +0100 Subject: [PATCH] Fix broken redir_target passing. --- src/templates/file_data.tmpl | 2 +- src/templates/playlist.tmpl | 2 +- src/ytplom/http.py | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/templates/file_data.tmpl b/src/templates/file_data.tmpl index 4ae310e..8df4bf0 100644 --- a/src/templates/file_data.tmpl +++ b/src/templates/file_data.tmpl @@ -10,5 +10,5 @@ td.tag_checkboxes { width: 1em; } {% block body %} {{ macros.nav_head(page_names) }} -{{ macros.file_data_form(file, unused_tags, page_names, redir_target="/{{page_names.file}}/{{file.digest.b64}}", flag_names) }} +{{ macros.file_data_form(file, unused_tags, page_names, redir_target, flag_names) }} {% endblock %} diff --git a/src/templates/playlist.tmpl b/src/templates/playlist.tmpl index 21c9fd8..63671f7 100644 --- a/src/templates/playlist.tmpl +++ b/src/templates/playlist.tmpl @@ -61,7 +61,7 @@ filter tags: {% if current_file %} -{{ macros.file_data_form(current_file, unused_tags, page_names, redir_target="{{redir_target}}", playlist_view=true) }} +{{ macros.file_data_form(current_file, unused_tags, page_names, redir_target, playlist_view=true) }} {% endif %} diff --git a/src/ytplom/http.py b/src/ytplom/http.py index 696dd98..6d7a085 100644 --- a/src/ytplom/http.py +++ b/src/ytplom/http.py @@ -302,10 +302,13 @@ class _TaskHandler(BaseHTTPRequestHandler): with DbConn() as conn: file = VideoFile.get_one(conn, digest) unused_tags = file.unused_tags(conn) + redir_target = Path('/').joinpath(PAGE_NAMES['file']).joinpath( + file.digest.b64) self._send_rendered_template(_NAME_TEMPLATE_FILE_DATA, {'file': file, 'flag_names': list(FILE_FLAGS), - 'unused_tags': unused_tags}) + 'unused_tags': unused_tags, + 'redir_target': redir_target}) def _send_files_index(self, params: _ReqMap) -> None: filter_path = FilterStr(params.single_value('filter_path')) -- 2.30.2