mime-types 0.1.1.0 → 0.1.2.0
raw patch · 3 files changed
+31/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Network.Mime: defaultExtensionMap :: ExtensionMap
+ Network.Mime: type ExtensionMap = Map MimeType [Extension]
Files
- ChangeLog.md +6/−0
- Network/Mime.hs +24/−2
- mime-types.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,9 @@+## 0.1.2.0++* Added `defaultExtensionMap` to provide the inverse of `defaultMimeMap`.++See PR [#930](https://github.com/yesodweb/wai/pull/930) and [#948](https://github.com/yesodweb/wai/pull/948).+ ## 0.1.1.0 * Replace `audio/x-mpegurl` with IANA registered type
Network/Mime.hs view
@@ -6,6 +6,7 @@ -- * Defaults , defaultMimeType , defaultMimeMap+ , defaultExtensionMap -- * Utilities , fileNameExtensions -- * Types@@ -13,8 +14,10 @@ , MimeType , MimeMap , Extension+ , ExtensionMap ) where +import qualified Data.List as L import Data.Text (Text) import qualified Data.Text as T import Data.ByteString (ByteString)@@ -24,6 +27,12 @@ -- | Maps extensions to mime types. type MimeMap = Map.Map Extension MimeType +-- | Maps mime types to extensions.+-- The list of extensions is in alphabetical order.+--+-- @since 0.1.2.0+type ExtensionMap = Map.Map MimeType [Extension]+ -- | The filename component of a filepath, leaving off the directory but -- keeping all extensions. type FileName = Text@@ -75,8 +84,21 @@ -- -- Generated from the Apache and nginx mime.types files. defaultMimeMap :: MimeMap-defaultMimeMap = Map.fromAscList [- ("123", "application/vnd.lotus-1-2-3")+defaultMimeMap = Map.fromAscList mimeAscList++-- | A mapping of 'MimeType' to a set of 'Extension's.+--+-- @since 0.1.2.0+defaultExtensionMap :: ExtensionMap+defaultExtensionMap =+ L.foldr go mempty mimeAscList+ where+ go (ext, mimeType) =+ Map.alter (Just . maybe [ext] (ext :)) mimeType++mimeAscList :: [(Extension, MimeType)]+mimeAscList =+ [ ("123", "application/vnd.lotus-1-2-3") , ("3dml", "text/vnd.in3d.3dml") , ("3ds", "image/x-3ds") , ("3g2", "video/3gpp2")
mime-types.cabal view
@@ -1,5 +1,5 @@ name: mime-types-version: 0.1.1.0+version: 0.1.2.0 synopsis: Basic mime-type handling types and functions description: API docs and the README are available at <http://www.stackage.org/package/mime-types>. homepage: https://github.com/yesodweb/wai