Skip to content

Commit a29af1e

Browse files
committed
Improved support for codeload.github.com in url2purl #47
Signed-off-by: Thomas Druez <[email protected]>
1 parent 255e232 commit a29af1e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/packageurl/contrib/url2purl.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,11 @@ def build_github_api_purl(url):
358358

359359

360360
# https://codeload.github.com/nexB/scancode-toolkit/tar.gz/v3.1.1
361+
# https://codeload.github.com/berngp/grails-rest/zip/release/0.7
361362
github_codeload_pattern = (
362-
r"https?://codeload.github.com/"
363-
r"(?P<namespace>.+)/(?P<name>.+)/(zip|tar.gz|tar.bz2|tgz)/v?(?P<version>.+)$"
363+
r"https?://codeload.github.com/(?P<namespace>.+)/(?P<name>.+)/"
364+
r"(zip|tar.gz|tar.bz2|tgz)/(.*/)*"
365+
r"v?(?P<version>.+)$"
364366
)
365367

366368
register_pattern('github', github_codeload_pattern)

tests/contrib/data/url2purl.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@
192192
"https://codeload.github.com/nexB/scancode-toolkit/zip/v3.1.1": "pkg:github/nexb/[email protected]",
193193
"https://codeload.github.com/nexB/scancode.io/tar.gz/1.0": "pkg:github/nexb/[email protected]",
194194
"https://codeload.github.com/nexB/scancode.io/tar.gz/v1.0": "pkg:github/nexb/[email protected]",
195+
"https://codeload.github.com/berngp/grails-rest/zip/release/0.7": "pkg:github/berngp/[email protected]",
196+
"https://codeload.github.com/eclipse/m2e-core/zip/releases/1.2/1.2.0.20120903-1050": "pkg:github/eclipse/[email protected]",
195197
"https://github.com/nexB/scancode-toolkit/archive/3.1.1.zip": "pkg:github/nexb/[email protected]",
196198
"https://github.com/nexB/scancode-toolkit/archive/v3.1.1.zip": "pkg:github/nexb/[email protected]",
197199
"https://github.com/pypa/get-virtualenv/raw/20.0.31/public/virtualenv.pyz": "pkg:github/pypa/[email protected]#public/virtualenv.pyz",
@@ -217,7 +219,6 @@
217219
"https://github.com/downloads/mozilla/rhino/rhino1_7R4.zip" : "pkg:github/mozilla/rhino@1_7R4",
218220
"https://github.com/pombredanne/schematics.git" : "pkg:github/pombredanne/schematics",
219221
"https://github.com/jgoerzen/configfile/archive/upstream/1.1.4.tar.gz": "pkg:github/jgoerzen/[email protected]",
220-
"https://codeload.github.com/berngp/grails-rest/zip/release/0.7": "pkg:github/berngp/grails-rest@release/0.7",
221222
"https://github.com/JetBrains/intellij-community/archive/idea/173.4710.11.zip": "pkg:github/jetbrains/[email protected]",
222223
"https://github.com/knime/knime-core/archive/analytics-platform/3.6.0.zip": "pkg:github/knime/[email protected]",
223224
"https://github.com/renozao/NMF/archive/hotfix/0.20.1.zip": "pkg:github/renozao/[email protected]",

0 commit comments

Comments
 (0)