multipart 0.2.0 → 0.2.1
raw patch · 3 files changed
+19/−8 lines, 3 filesdep −faildep ~bytestring
Dependencies removed: fail
Dependency ranges changed: bytestring
Files
- CHANGELOG.md +6/−0
- Network/Multipart.hs +11/−4
- multipart.cabal +2/−4
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Changelog +### 0.2.1++* Fix parsing of boundaries if newlines are missing. Thanks to Matthew+ Bauer.+* Building this package with ghc versions before 8.x is no longer supported.+ ### 0.2.0 * Monad.Fail no longer exists in `base-4.13.0.0` and beyond; the function now
Network/Multipart.hs view
@@ -116,15 +116,22 @@ -- are not included in any of the strings returned. -- Returns 'Nothing' if there is no boundary. splitAtBoundary b s =- let bcrlf = BS.append "\r\n--" b- (before, t) = breakOn (BS.toStrict bcrlf) s- in case BS.stripPrefix bcrlf t of+ let b' = BS.append "--" b+ bcrlf = BS.append "\r\n" b'++ -- check if we are at the beginning of a boundary, if so, we+ -- won’t have a \r\n+ prefix = if BS.isPrefixOf b' s then b'+ else bcrlf++ (before, t) = breakOn (BS.toStrict prefix) s+ in case BS.stripPrefix prefix t of Nothing -> Nothing Just t' -> let after = case BS.stripPrefix "\r\n" t' of Nothing -> t' Just t'' -> t''- in Just (before, bcrlf, after)+ in Just (before, prefix, after) -- | Check whether a string for which 'isBoundary' returns true -- has two dashes after the boudary string.
multipart.cabal view
@@ -1,5 +1,5 @@ name: multipart-version: 0.2.0+version: 0.2.1 synopsis: Parsers for the HTTP multipart format description: Parsers and data types for the HTTP multipart format from RFC2046. copyright: Bjorn Bringert, Andy Gill, Anders Kaseorg, Ian Lynagh, Erik Meijer, Sven Panne, Jeremy Shaw@@ -11,6 +11,7 @@ license-file: LICENSE build-type: Simple cabal-version: >=1.10+tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.1 extra-source-files: CHANGELOG.md@@ -32,6 +33,3 @@ , bytestring >= 0.10.8.0 && < 0.11 , parsec >= 2.0 , stringsearch- if !impl(ghc >= 8.0)- build-depends:- fail >= 4.9.0.0 && < 4.10