Skip to content

Commit 9e0a818

Browse files
authored
Recognize more tarball extensions (#385)
1 parent e80fc8f commit 9e0a818

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Niv/GitHub.hs

+11-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,17 @@ githubUpdate prefetch latestRev ghRepo = proc () -> do
3232
-<
3333
()
3434
url <- update "url" -< urlTemplate
35-
let isTarGuess = (\u -> "tar.gz" `T.isSuffixOf` u || ".tgz" `T.isSuffixOf` u) <$> url
36-
type' <- useOrSet "type" -< bool "file" "tarball" <$> isTarGuess :: Box T.Text
35+
let isTarGuess u =
36+
any
37+
(`T.isSuffixOf` u)
38+
[ ".tar",
39+
".tar.gz",
40+
".tgz",
41+
".tar.bz2",
42+
".tar.xz",
43+
".tar.zst"
44+
]
45+
type' <- useOrSet "type" -< bool "file" "tarball" . isTarGuess <$> url :: Box T.Text
3746
let doUnpack = (== "tarball") <$> type'
3847
_sha256 <- update "sha256" <<< run (\(up, u) -> prefetch up u) -< (,) <$> doUnpack <*> url
3948
returnA -< ()

0 commit comments

Comments
 (0)