0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-12 15:01:28 -05:00

🐛 Fix unexpected unhandled exception on 404 requests on media.

This commit is contained in:
Andrey Antukh 2020-03-26 11:23:41 +01:00
parent fc6948e627
commit 1ed1c95e4d
2 changed files with 8 additions and 1 deletions

View file

@ -58,7 +58,7 @@
:method :get}]]]]
handler (vw/handler ctx
(vw/assets "/media/*" {:root "resources/public/media/"})
(vw/assets "/media/*" {:root "resources/public/media"})
(vw/assets "/static/*" {:root "resources/public/static"})
(vw/router routes))]

View file

@ -69,9 +69,16 @@
(fn [^Router router]
(let [^Route route (.route router path)
^Handler handler (doto (StaticHandler/create)
(.setCachingEnabled false)
(.setWebRoot root)
(.setDirectoryListing true))]
(.handler route handler)
;; A hack for lie to body handler that request is already handled.
(.handler route
(reify Handler
(handle [_ rc]
(.put ^RoutingContext rc "__body-handled" true)
(.next ^RoutingContext rc))))
router))))
(defn- default-handler