File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ Behaviour changes:
1010
1111Other enhancements:
1212
13+ * In addition to supporting ` .tar.gz ` and ` .zip ` files as remote archives,
14+ plain ` .tar ` files are now accepted too. This will additionally help with
15+ cases where HTTP servers mistakenly set the transfer encoding to ` gzip ` . See
16+ [ #3647 ] ( https://github.com/commercialhaskell/stack/issues/3647 ) .
17+
1318Bug fixes:
1419
1520* For versions of Cabal before 1.24, ensure that the dependencies of
Original file line number Diff line number Diff line change @@ -109,8 +109,8 @@ resolveSinglePackageLocation projRoot (PLArchive (Archive url subdir msha)) = do
109109
110110 let fp = toFilePath file
111111
112- let tryTar = do
113- logDebug $ " Trying to untar " <> T. pack fp
112+ let tryTargz = do
113+ logDebug $ " Trying to ungzip/ untar " <> T. pack fp
114114 liftIO $ withBinaryFile fp ReadMode $ \ h -> do
115115 lbs <- L. hGetContents h
116116 let entries = Tar. read $ GZip. decompress lbs
@@ -120,14 +120,20 @@ resolveSinglePackageLocation projRoot (PLArchive (Archive url subdir msha)) = do
120120 archive <- fmap Zip. toArchive $ liftIO $ L. readFile fp
121121 liftIO $ Zip. extractFilesFromArchive [Zip. OptDestination
122122 (toFilePath dirTmp)] archive
123+ tryTar = do
124+ logDebug $ " Trying to untar (no ungzip) " <> T. pack fp
125+ liftIO $ withBinaryFile fp ReadMode $ \ h -> do
126+ lbs <- L. hGetContents h
127+ let entries = Tar. read lbs
128+ Tar. unpack (toFilePath dirTmp) entries
123129 err = throwM $ UnableToExtractArchive url file
124130
125131 catchAnyLog goodpath handler =
126132 catchAny goodpath $ \ e -> do
127133 logDebug $ " Got exception: " <> T. pack (show e)
128134 handler
129135
130- tryTar `catchAnyLog` tryZip `catchAnyLog` err
136+ tryTargz `catchAnyLog` tryZip `catchAnyLog` tryTar `catchAnyLog` err
131137 renameDir dirTmp dir
132138
133139 x <- listDir dir
You can’t perform that action at this time.
0 commit comments