From 843683d024f767de236f74d24a3348f69181a720 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 10 Sep 2020 12:45:54 +0200 Subject: [PATCH] throw utf8 errors --- Codec/Archive/Zip/Conduit/UnZip.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Codec/Archive/Zip/Conduit/UnZip.hs b/Codec/Archive/Zip/Conduit/UnZip.hs index c8ef675..0d13cc9 100644 --- a/Codec/Archive/Zip/Conduit/UnZip.hs +++ b/Codec/Archive/Zip/Conduit/UnZip.hs @@ -181,6 +181,7 @@ unZipStream = next where nlen <- fromIntegral <$> G.getWord16le elen <- fromIntegral <$> G.getWord16le name <- G.getByteString nlen + dName <- if testBit gpf 11 then Left <$> either (fail . show) return (TE.decodeUtf8' name) else return $ Right name let getExt ext = do t <- G.getWord16le z <- fromIntegral <$> G.getWord16le @@ -217,7 +218,7 @@ unZipStream = next where } return FileHeader { fileEntry = ZipEntry - { zipEntryName = if testBit gpf 11 then Left (TE.decodeUtf8 name) else Right name + { zipEntryName = dName , zipEntryTime = time , zipEntrySize = if testBit gpf 3 then Nothing else Just extZip64USize , zipEntryExternalAttributes = Nothing