From a9bf53adbfc72dc8b3dfc630085e084ec0981ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marina=20L=C3=B3pez?= Date: Wed, 7 Oct 2026 11:10:02 +0200 Subject: [PATCH] Revert ":bug: Preserve path segments when joining backend URIs (#12152)" (#12156) This reverts commit 2a6e92a7d9a5520365276f7b9a6ae59d478159ee. --- backend/src/app/config.clj | 10 +--------- backend/test/backend_tests/config_test.clj | 9 --------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/backend/src/app/config.clj b/backend/src/app/config.clj index 6c04c82861..10a97b7bee 100644 --- a/backend/src/app/config.clj +++ b/backend/src/app/config.clj @@ -432,13 +432,6 @@ (or (c/get config :file-clean-delay) (ct/duration {:days 2}))) -(defn- join-path-segments - [segments] - (let [path (->> segments (map str) (str/join "/"))] - (->> (str/split path #"/") - (remove str/blank?) - (str/join "/")))) - (defn join-uri "Join path segments onto a base URI, preserving a potential subpath (same semantics as the frontend config). The base is normalized with @@ -447,8 +440,7 @@ [base & segments] (assert (not (some #(str/starts-with? % "/") segments)) "URI segments must be relative (no leading slash)") - (str (u/join (u/ensure-path-slash base) - (join-path-segments segments)))) + (str (apply u/join (u/ensure-path-slash base) segments))) (defn get-public-uri "Canonical public URI builder: `join-uri` over the configured diff --git a/backend/test/backend_tests/config_test.clj b/backend/test/backend_tests/config_test.clj index 3fb8a96e57..863be00a5e 100644 --- a/backend/test/backend_tests/config_test.clj +++ b/backend/test/backend_tests/config_test.clj @@ -34,15 +34,6 @@ (t/is (= "https://nitrate.example.com/api/teams/123" (cf/join-uri "https://nitrate.example.com/" "api/teams/123"))))) -(t/deftest join-uri-joins-multiple-segments - (t/testing "path segments are appended instead of replacing previous segments" - (t/is (= "https://nitrate.example.com/admin-console/api/teams/team-id/users/profile-id" - (cf/join-uri "https://nitrate.example.com/admin-console" - "api/teams/" - "team-id" - "users/" - "profile-id"))))) - (t/deftest join-uri-rejects-leading-slash (t/testing "a leading slash would drop the subpath, so it fails fast" (t/is (thrown? AssertionError