diff --git a/Codec/Archive/Zip/Conduit/Types.hs b/Codec/Archive/Zip/Conduit/Types.hs index dfcbe4a..a94ba2e 100644 --- a/Codec/Archive/Zip/Conduit/Types.hs +++ b/Codec/Archive/Zip/Conduit/Types.hs @@ -9,7 +9,7 @@ import Data.Semigroup (Semigroup(..)) import Data.String (IsString(..)) import Data.Time.LocalTime (LocalTime) import Data.Typeable (Typeable) -import Data.Word (Word64) +import Data.Word (Word32, Word64) -- |Errors thrown during zip file processing newtype ZipError = ZipError String @@ -32,6 +32,7 @@ data ZipEntry = ZipEntry { zipEntryName :: ByteString -- ^File name (in posix format, no leading slashes), usually utf-8 encoded, with a trailing slash for directories , zipEntryTime :: LocalTime -- ^Modification time , zipEntrySize :: Maybe Word64 -- ^Size of file data (if known); checked on zipping and also used as hint to enable zip64 + , zipEntryExternalFileAttributes :: Word32 -- ^External file attributes (permissions). } deriving (Eq, Show) -- |The data contents for a 'ZipEntry'. For empty entries (e.g., directories), use 'mempty'. diff --git a/Codec/Archive/Zip/Conduit/UnZip.hs b/Codec/Archive/Zip/Conduit/UnZip.hs index 95af05a..7b677c9 100644 --- a/Codec/Archive/Zip/Conduit/UnZip.hs +++ b/Codec/Archive/Zip/Conduit/UnZip.hs @@ -219,6 +219,7 @@ unZipStream = next where { zipEntryName = name , zipEntryTime = time , zipEntrySize = if testBit gpf 3 then Nothing else Just extZip64USize + , zipEntryExternalFileAttributes = 0 } , fileDecompress = dcomp , fileCSize = extZip64CSize diff --git a/Codec/Archive/Zip/Conduit/Zip.hs b/Codec/Archive/Zip/Conduit/Zip.hs index 5422f05..c3246d5 100644 --- a/Codec/Archive/Zip/Conduit/Zip.hs +++ b/Codec/Archive/Zip/Conduit/Zip.hs @@ -189,7 +189,7 @@ zipStream ZipOptions{..} = execStateC 0 $ do P.putWord16le 0 -- comment length P.putWord16le 0 -- disk number P.putWord16le 0 -- internal file attributes - P.putWord32le 0 -- external file attributes + P.putWord32le zipEntryExternalFileAttributes -- external file attributes P.putWord32le $ if o64 then maxBound32 else fromIntegral off P.putByteString zipEntryName when a64 $ do diff --git a/cmd/zip.hs b/cmd/zip.hs index d29f909..d2ede75 100644 --- a/cmd/zip.hs +++ b/cmd/zip.hs @@ -46,6 +46,7 @@ generate (p:paths) = do { zipEntryName = BSC.pack $ dropWhile ('/' ==) p , zipEntryTime = utcToLocalTime utc t -- FIXME: timezone , zipEntrySize = Nothing + , zipEntryExternalFileAttributes = 0 } isd <- liftIO $ doesDirectoryExist p if isd diff --git a/stack.yaml b/stack.yaml index 7af5a28..be18c39 100644 --- a/stack.yaml +++ b/stack.yaml @@ -2,3 +2,6 @@ resolver: lts-11.1 packages: - '.' extra-deps: [] +nix: + packages: + - zlib