about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2021-10-25 23:39:23 +0200
committersternenseemann <sternenseemann@systemli.org>2021-10-25 23:39:23 +0200
commit919640476c6b9ab19d120318e18692fa3651e167 (patch)
treef4b3c72ce10890a3a4e0258e080cd8f4a1263b3d
parentf6ff8f9b5f6262afda1b5f51189c2b6c3b1f1a78 (diff)
fix(GopherProxy.Params): fix parsing of --default-mime-type
The Read instance of ByteString expects quotes around the input value
which is quite cumbersome (and counterintuitive) to do on the command
line, since it requires escaping extra quotes. Obviously using the
`utf8ByteString` facility we already have is more correct here.
-rw-r--r--ChangeLog.md3
-rw-r--r--src/GopherProxy/Params.hs2
2 files changed, 4 insertions, 1 deletions
diff --git a/ChangeLog.md b/ChangeLog.md
index 543e852..6ebed38 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -3,6 +3,9 @@
 ## 0.1.1.3 -- 2021-10-25
 
 * Support (and require) `attoparsec >= 0.14`
+* Fix parsing of the `--default-mime-type` flag: Previoulsy the
+  `Read` instance was used and thus required the user to surround
+  the mime type with (extra) quotes.
 
 ## 0.1.1.1 -- 2017-01-06
 
diff --git a/src/GopherProxy/Params.hs b/src/GopherProxy/Params.hs
index 72a6991..108a31a 100644
--- a/src/GopherProxy/Params.hs
+++ b/src/GopherProxy/Params.hs
@@ -62,7 +62,7 @@ params = Params
   <*> switch
     (long "listen-public"
     <> help "wether gopher-proxy should accept connection on public IP addresses.")
-  <*> optionalWithDefault defaultMimeType (option auto
+  <*> optionalWithDefault defaultMimeType (option utf8ByteString
     (long "default-mime-type"
     <> metavar "MIMETYPE"
     <> help "gopher-proxy uses this mimetype, if it can't guess the type, defaults to application/octet-stream"))