@@ -775,12 +775,13 @@ fetchItem sourceURL s =
775775 Nothing -> openURL s' -- will throw error
776776 (Nothing, _) -> E.try readLocalFile -- get from local file system
777777 where readLocalFile = do
778− let mime = case takeExtension s of
779− ".gz" -> getMimeType $ dropExtension s
780− x -> getMimeType x
781− cont <- BS.readFile $ unEscapeString $ dropFragmentAndQuery s
778+ cont <- BS.readFile fp
782779 return (cont, mime)
783780 dropFragmentAndQuery = takeWhile (\c -> c /= '?' && c /= '#')
781+ fp = unEscapeString $ dropFragmentAndQuery s
782+ mime = case takeExtension fp of
783+ ".gz" -> getMimeType $ dropExtension fp
784+ x -> getMimeType x
784785 ensureEscaped = escapeURIString isAllowedInURI
785786
786787-- | Like 'fetchItem', but also looks for items in a 'MediaBag'.