Skip to content

Commit

Permalink
Remove loading slash from asset-path
Browse files Browse the repository at this point in the history
Asset-path might start with slash.
  • Loading branch information
Deraen committed Jun 14, 2015
1 parent c6bbab5 commit e405e1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/adzerk/boot_reload/server.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(defn web-path [proto rel-path tgt-path asset-path]
(if-not (= "file:" proto)
(if asset-path
(string/replace rel-path (re-pattern (str "^" asset-path "/")) "")
(string/replace rel-path (re-pattern (str "^" (string/replace asset-path #"^/" "") "/")) "")
(str "/" rel-path))
(.getCanonicalPath (io/file tgt-path rel-path))))

Expand Down
3 changes: 3 additions & 0 deletions test/adzerk/boot_reload/server_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
(is (= "js/out/saapas/core.js"
(web-path "http:" "public/js/out/saapas/core.js" nil "public")))

(is (= "js/out/saapas/core.js"
(web-path "http:" "public/js/out/saapas/core.js" nil "/public")))

(is (= "public/js/out/saapas/core.js"
(web-path "http:" "public/js/out/saapas/core.js" nil "foobar")))
))

0 comments on commit e405e1e

Please sign in to comment.