diff options
| author | Tom Smeding <tom@tomsmeding.com> | 2026-06-28 18:17:29 +0200 |
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2026-06-28 18:17:29 +0200 |
| commit | 5299662f7dacdb636df009aefdc8a7d52d5faf8e (patch) | |
| tree | b53ced8ca1cdbdc9eeadba2dba9a501b0933cf8d /src | |
| parent | 43bba6e5f373e3da5403eeb0488e1d11e7bbee72 (diff) | |
Content types on static files
Diffstat (limited to 'src')
| -rw-r--r-- | src/Main.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Main.hs b/src/Main.hs index 246b5d3..c7bc648 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -286,7 +286,10 @@ mainServe confpath = do index <- initIndex (confLogsDir config) (econfChannels config) - let staticFiles = ["style.css", "robots.txt", "favicon.png"] + let staticFiles = + [("style.css", "text/css") + ,("robots.txt", "text/plain") + ,("favicon.png", "image/png")] let settings = defaultSettings { setPort = confPort config } @@ -303,8 +306,8 @@ mainServe confpath = do pageCalendar config index alias ["cal", TE.decodeUtf8' -> Right alias, TE.decodeUtf8' -> Right date] -> pageCalendarDay config index req alias date - [fname] | fname `elem` staticFiles -> - return $ responseFile status200 [] ("pages/" ++ BS8.unpack fname) + [fname] | Just mime <- lookup fname staticFiles -> + return $ responseFile status200 [("Content-Type", mime)] ("pages/" ++ BS8.unpack fname) _ -> sendText404 "URL not found" |
