Skip to content

Commit

Permalink
Make guessing content type from files more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
weavejester committed Oct 19, 2024
1 parent 9f0268b commit aaa27d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ring-core/src/ring/middleware/content_type.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(defn- guess-mime-type [{:keys [uri]} {:keys [body]} mime-types]
(or (ext-mime-type uri mime-types)
(when (instance? java.io.File body)
(ext-mime-type (str body) mime-types))))
(ext-mime-type (.getAbsolutePath ^java.io.File body) mime-types))))

(defn content-type-response
"Adds a content-type header to response. See: wrap-content-type."
Expand Down

0 comments on commit aaa27d0

Please sign in to comment.