Skip to content

Commit 9b5e88d

Browse files
authored
[Sources] Improve regex to match GitHub-generated archives (#409)
1 parent 0abbe35 commit 9b5e88d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Sources.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function check_github_archive(url::String)
2626
# <https://github.com/bazel-contrib/SIG-rules-authors/issues/11#issuecomment-1029861300>
2727
# 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/tags/)?[^/]+\.(tar\.gz|zip)$")
29+
if contains(url, r"github.com/[^/]+/[^/]+/archive/(refs/tags/(releases/)?)?[^/]+\.(tar\.gz|zip)$")
3030
throw(ArgumentError("""
3131
The archive automatically generated by GitHub
3232
$(url)

test/sources.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ using JSON
1818
@test_throws ArgumentError ArchiveSource("https://github.com/ralna/ARCHDefs/archive/refs/tags/v2.0.3x.tar.gz", "6583e27f84338447767bbdf4335514c8836ae4ad54f5e66280307e8b57189cff")
1919
@test_throws ArgumentError FileSource("https://github.com/ralna/ARCHDefs/archive/v2.0.3x.tar.gz", "6583e27f84338447767bbdf4335514c8836ae4ad54f5e66280307e8b57189cff")
2020
@test_throws ArgumentError FileSource("https://github.com/ralna/ARCHDefs/archive/refs/tags/v2.0.3x.tar.gz", "6583e27f84338447767bbdf4335514c8836ae4ad54f5e66280307e8b57189cff")
21+
@test_throws ArgumentError FileSource("https://github.com/coin-or/qpOASES/archive/refs/tags/releases/3.2.1.zip", "28dbe55fdfdca5f8a43e8fbfbdb5a90c52546568f8ecc7b29bd1d42dc1ccdd2a")
2122

2223
@test SetupSource("https://ftp.gnu.org/gnu/wget/wget-1.20.3.tar.gz", "wget-1.20.3.tar.gz", "", "") isa SetupSource{ArchiveSource}
2324
@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)