diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d19f841d8..a3bf720fe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed +- #1369, Change `raw-media-types` to accept a string of comma separated MIME types - @Dansvidania + ## [6.0.1] - 2019-07-30 ### Added diff --git a/src/PostgREST/Config.hs b/src/PostgREST/Config.hs index 73f3d33117..3544a9ce62 100644 --- a/src/PostgREST/Config.hs +++ b/src/PostgREST/Config.hs @@ -167,9 +167,9 @@ readOptions = do <*> pure False <*> (fmap (fmap coerceText) <$> C.subassocs "app.settings" C.value) <*> (maybe (Right [JSPKey "role"]) parseRoleClaimKey <$> optValue "role-claim-key") - <*> (maybe ["public"] splitExtraSearchPath <$> optValue "db-extra-search-path") + <*> (maybe ["public"] splitOnCommas <$> optValue "db-extra-search-path") <*> ((\x y -> QualifiedIdentifier x <$> y) <$> dbSchema <*> optString "root-spec") - <*> (fmap encodeUtf8 <$> optionalListOfText "raw-media-types") + <*> (maybe [] (fmap encodeUtf8 . splitOnCommas) <$> optValue "raw-media-types") parseJwtAudience :: C.Key -> C.Parser C.Config (Maybe StringOrURI) parseJwtAudience k = @@ -180,12 +180,6 @@ readOptions = do (Just "") -> pure Nothing aud' -> pure aud' - optionalListOfText :: C.Key -> C.Parser C.Config [Text] - optionalListOfText k = - C.optional k (C.list C.string) >>= \case - Nothing -> pure [] - Just types -> pure types - reqString :: C.Key -> C.Parser C.Config Text reqString k = C.required k C.string @@ -219,9 +213,9 @@ readOptions = do parseRoleClaimKey (C.String s) = pRoleClaimKey s parseRoleClaimKey v = pRoleClaimKey $ show v - splitExtraSearchPath :: C.Value -> [Text] - splitExtraSearchPath (C.String s) = strip <$> splitOn "," s - splitExtraSearchPath _ = [] + splitOnCommas :: C.Value -> [Text] + splitOnCommas (C.String s) = strip <$> splitOn "," s + splitOnCommas _ = [] opts = info (helper <*> pathParser) $ fullDesc @@ -283,7 +277,7 @@ readOptions = do |# root-spec = "stored_proc_name" | |## content types to produce raw output - |# raw-media-types=["image/png","image/jpg"] + |# raw-media-types="image/png, image/jpg" |] pathParser :: Parser FilePath