Skip to content

Commit

Permalink
Set eVersionMadeBy to 0 (FAT) in toEntry.
Browse files Browse the repository at this point in the history
Since external attributes are set to 0 by default.

Only set it to something else if we're actually reading
the file and getting its external attributes.

I suspect this will fix jgm/pandoc#2822.
  • Loading branch information
jgm committed Mar 28, 2016
1 parent 857b077 commit 8113bbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Codec/Archive/Zip.hs
Expand Up @@ -241,7 +241,7 @@ toEntry path modtime contents =
, eUncompressedSize = fromIntegral uncompressedSize
, eExtraField = B.empty
, eFileComment = B.empty
, eVersionMadeBy = versionMadeBy
, eVersionMadeBy = 0 -- FAT
, eInternalFileAttributes = 0 -- potentially non-text
, eExternalFileAttributes = 0 -- appropriate if from stdin
, eCompressedData = finalData
Expand Down Expand Up @@ -276,7 +276,8 @@ readEntry opts path = do
#else
do fm <- fmap fileMode $ getFileStatus path'
let modes = fromIntegral $ shiftL (toInteger fm) 16
return $ entry { eExternalFileAttributes = modes }
return $ entry { eExternalFileAttributes = modes,
eVersionMadeBy = versionMadeBy }
#endif

when (OptVerbose `elem` opts) $ do
Expand Down
2 changes: 1 addition & 1 deletion zip-archive.cabal
@@ -1,5 +1,5 @@
Name: zip-archive
Version: 0.3
Version: 0.3.0.1
Cabal-Version: >= 1.10
Build-type: Custom
Synopsis: Library for creating and modifying zip archives.
Expand Down

0 comments on commit 8113bbf

Please sign in to comment.