Skip to content

Commit ae550db

Browse files
committed
fix(backend): content-type middleware
1 parent 26d58b4 commit ae550db

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/parts/middleware.clj

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[parts.auth :as auth]
88
[reitit.ring.middleware.exception :as exception]
99
[ring.middleware.anti-forgery :refer [wrap-anti-forgery]]
10+
[ring.middleware.content-type :refer [wrap-content-type]]
1011
[ring.middleware.defaults :refer [api-defaults wrap-defaults site-defaults]]
1112
[ring.middleware.resource :refer [wrap-resource]]
1213
[ring.util.response :as response])
@@ -152,12 +153,14 @@
152153
(assoc-in [:security :xss-protection] {:mode :block}))))
153154

154155
(defn wrap-core-middlewares
155-
"Apply essential Ring middleware for the entire application. Currently, this
156-
is only `wrap-resources`, which allows to download static files from
157-
resources/public."
156+
"Apply essential Ring middleware for the entire application.
157+
- `wrap-resource`: Serves static files from resources/public
158+
- `wrap-content-type`: Sets proper MIME types based on file extensions,
159+
ensuring SVG files are served as image/svg+xml instead of text/plain"
158160
[handler]
159161
(-> handler
160-
(wrap-resource "public")))
162+
(wrap-resource "public")
163+
(wrap-content-type)))
161164

162165
(defn wrap-html-response
163166
"Middleware for properly formatting HTML responses.

0 commit comments

Comments
 (0)