Skip to content

Commit d123f0f

Browse files
committed
Add import for takeExtension to handle file type detection
This change enhances the staticFileHeaders function by allowing it to determine the Content-Type based on file extensions, improving the handling of static files served by the application.
1 parent b8ff07b commit d123f0f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Monocle/Main.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import Prometheus.Metric.GHC (ghcMetrics)
2929
import Servant
3030
import Servant.Auth.Server (CookieSettings (..), cookieXsrfSetting, defaultCookieSettings, defaultJWTSettings)
3131
import System.Directory qualified
32+
import System.FilePath (takeExtension)
3233

3334
import Effectful qualified as E
3435
import Effectful.Concurrent.MVar qualified as E
@@ -65,7 +66,7 @@ mkStaticMiddleware publicUrl title webAppPath = do
6566

6667
-- Content-Type for static files
6768
staticFileHeaders path =
68-
[
69+
[
6970
( hContentType
7071
, case takeExtension path of
7172
".css" -> "text/css"

0 commit comments

Comments
 (0)