Skip to content
This repository
Browse code

Fix compojure.http.middleware/extension to correctly handle filenames…

… containing multiple periods.
  • Loading branch information...
commit 40083894d100d89347dad9748110fe06b9aab323 1 parent 1c11486
Allen Rohner arohner authored committed
2  src/compojure/http/middleware.clj
@@ -106,7 +106,7 @@
106 106 (defn- extension
107 107 "Returns the text after the last . of a String or nil."
108 108 [s]
109   - (second (re-find #"\.(.*$)" s)))
  109 + (last (re-split #"\." s)))
110 110
111 111 (defn- request-mimetype
112 112 "Derives the mimetype from a request. See with-mimetypes for options."
3  test/compojure/http/middleware_test.clj
@@ -100,7 +100,8 @@
100 100 "/" "text/html"
101 101 "/foobar" "text/html"
102 102 "/file.pdf" "application/pdf"
103   - "/files/bar.css" "text/css"))
  103 + "/files/bar.css" "text/css"
  104 + "/files/js/jquery.fancybox-1.3.0.js" "text/javascript"))
104 105
105 106 (deftest test-with-custom-mimetypes
106 107 (let [options {:mimetypes {"foo" "test/foo"

0 comments on commit 4008389

Please sign in to comment.
Something went wrong with that request. Please try again.