From 33582b4c1c8ff901e8746f8d1cc160c9e2b822d4 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 28 Oct 2018 18:22:41 +0900 Subject: [PATCH] Strip slash instead Also fix the only failing test --- modules/reitit-core/src/reitit/core.cljc | 4 ++-- test/cljc/reitit/core_test.cljc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/reitit-core/src/reitit/core.cljc b/modules/reitit-core/src/reitit/core.cljc index ff30fac8..b85e6f3c 100644 --- a/modules/reitit-core/src/reitit/core.cljc +++ b/modules/reitit-core/src/reitit/core.cljc @@ -33,8 +33,8 @@ (defn ensure-slash [^String string] (if (.endsWith string "/") - string - (str string "/"))) + (str/replace string #"/+$" "") + string)) (defn walk [raw-routes {:keys [path data routes expand] :or {data [], routes [], expand expand} diff --git a/test/cljc/reitit/core_test.cljc b/test/cljc/reitit/core_test.cljc index 8a7e3482..cc57e6b1 100644 --- a/test/cljc/reitit/core_test.cljc +++ b/test/cljc/reitit/core_test.cljc @@ -230,8 +230,8 @@ true [["/a/1/2"] ["/*b"]] - false [["/a"] - ["/a/"]] + true [["/a"] + ["/a/"]] false [["/a"] ["/a/1"]]