From 6d9ff9b5f26a8c578b9edd02c4e9068c0676381f Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Tue, 25 Mar 2025 19:43:00 +0100 Subject: [PATCH] backend: add trailing slash if needed Otherwise we can redirect to something like this: https://console.redhat.com/api/pulp-content/public-copr-stage@copr/TEST1742912352410340284-storage-pulp/fedora-41-x86_64/ --- .../copr/backend/templates/lighttpd/pulp-redirect.lua.j2 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/roles/copr/backend/templates/lighttpd/pulp-redirect.lua.j2 b/roles/copr/backend/templates/lighttpd/pulp-redirect.lua.j2 index 4d1a1812e1..d783a54cad 100644 --- a/roles/copr/backend/templates/lighttpd/pulp-redirect.lua.j2 +++ b/roles/copr/backend/templates/lighttpd/pulp-redirect.lua.j2 @@ -52,7 +52,14 @@ function pulp_url(copr_path) if string.sub(copr_path, 1, 9) == "/results/" then copr_path = string.sub(copr_path, 10) end - return pulp_content_url .. copr_path + + local url = pulp_content_url + if string.sub(url, -1) ~= "/" then + url = url .. "/" + end + + url = url .. copr_path + return url end