Skip to content

Commit 35a86ff

Browse files
authored
[Sources] fix github url check (#294)
1 parent ccfc219 commit 35a86ff

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Sources.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ function check_github_archive(url::String)
2424
# * https://github.com/spack/spack/issues/35250
2525
# Note: according to
2626
# <https://github.com/bazel-contrib/SIG-rules-authors/issues/11#issuecomment-1029861300>
27-
# the `/archive/refs/tag` should be more stable, but that didn't happen in the incident
27+
# the `/archive/refs/tags` should be more stable, but that didn't happen in the incident
2828
# on 2023-01-30, so it's unclear whether we can trust them.
29-
if contains(url, r"github.com/[^/]+/[^/]+/archive/(refs/tag/)?[^/]+\.(tar\.gz|zip)$")
29+
if contains(url, r"github.com/[^/]+/[^/]+/archive/(refs/tags/)?[^/]+\.(tar\.gz|zip)$")
3030
throw(ArgumentError("""
3131
The archive automatically generated by GitHub
3232
$(url)

test/sources.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ using JSON
1212
@test FileSource("https://curl.haxx.se/ca/cacert-2020-01-01.pem", "adf770dfd574a0d6026bfaa270cb6879b063957177a991d453ff1d302c02081f"; filename="cacert.pem").filename == "cacert.pem"
1313
# GitHub-generated archives are banned
1414
@test_throws ArgumentError ArchiveSource("https://github.com/ralna/ARCHDefs/archive/v2.0.3x.tar.gz", "6583e27f84338447767bbdf4335514c8836ae4ad54f5e66280307e8b57189cff")
15-
@test_throws ArgumentError ArchiveSource("https://github.com/ralna/ARCHDefs/archive/refs/tag/v2.0.3x.tar.gz", "6583e27f84338447767bbdf4335514c8836ae4ad54f5e66280307e8b57189cff")
15+
@test_throws ArgumentError ArchiveSource("https://github.com/ralna/ARCHDefs/archive/refs/tags/v2.0.3x.tar.gz", "6583e27f84338447767bbdf4335514c8836ae4ad54f5e66280307e8b57189cff")
1616
@test_throws ArgumentError FileSource("https://github.com/ralna/ARCHDefs/archive/v2.0.3x.tar.gz", "6583e27f84338447767bbdf4335514c8836ae4ad54f5e66280307e8b57189cff")
17-
@test_throws ArgumentError FileSource("https://github.com/ralna/ARCHDefs/archive/refs/tag/v2.0.3x.tar.gz", "6583e27f84338447767bbdf4335514c8836ae4ad54f5e66280307e8b57189cff")
17+
@test_throws ArgumentError FileSource("https://github.com/ralna/ARCHDefs/archive/refs/tags/v2.0.3x.tar.gz", "6583e27f84338447767bbdf4335514c8836ae4ad54f5e66280307e8b57189cff")
1818

1919
@test SetupSource("https://ftp.gnu.org/gnu/wget/wget-1.20.3.tar.gz", "wget-1.20.3.tar.gz", "", "") isa SetupSource{ArchiveSource}
2020
@test SetupSource("https://ftp.gnu.org/gnu/wget/wget-1.20.3.zip", "wget-1.20.3.zip", "", "") isa SetupSource{ArchiveSource}

0 commit comments

Comments
 (0)