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"]]