diff --git a/src/packageurl/contrib/url2purl.py b/src/packageurl/contrib/url2purl.py index 993523f..eea07ea 100644 --- a/src/packageurl/contrib/url2purl.py +++ b/src/packageurl/contrib/url2purl.py @@ -358,9 +358,11 @@ def build_github_api_purl(url): # https://codeload.github.com/nexB/scancode-toolkit/tar.gz/v3.1.1 +# https://codeload.github.com/berngp/grails-rest/zip/release/0.7 github_codeload_pattern = ( - r"https?://codeload.github.com/" - r"(?P.+)/(?P.+)/(zip|tar.gz|tar.bz2|tgz)/v?(?P.+)$" + r"https?://codeload.github.com/(?P.+)/(?P.+)/" + r"(zip|tar.gz|tar.bz2|tgz)/(.*/)*" + r"v?(?P.+)$" ) register_pattern('github', github_codeload_pattern) diff --git a/tests/contrib/data/url2purl.json b/tests/contrib/data/url2purl.json index 51eb6fb..03d2299 100644 --- a/tests/contrib/data/url2purl.json +++ b/tests/contrib/data/url2purl.json @@ -192,6 +192,8 @@ "https://codeload.github.com/nexB/scancode-toolkit/zip/v3.1.1": "pkg:github/nexb/scancode-toolkit@3.1.1", "https://codeload.github.com/nexB/scancode.io/tar.gz/1.0": "pkg:github/nexb/scancode.io@1.0", "https://codeload.github.com/nexB/scancode.io/tar.gz/v1.0": "pkg:github/nexb/scancode.io@1.0", + "https://codeload.github.com/berngp/grails-rest/zip/release/0.7": "pkg:github/berngp/grails-rest@0.7", + "https://codeload.github.com/eclipse/m2e-core/zip/releases/1.2/1.2.0.20120903-1050": "pkg:github/eclipse/m2e-core@1.2.0.20120903-1050", "https://github.com/nexB/scancode-toolkit/archive/3.1.1.zip": "pkg:github/nexb/scancode-toolkit@3.1.1", "https://github.com/nexB/scancode-toolkit/archive/v3.1.1.zip": "pkg:github/nexb/scancode-toolkit@3.1.1", "https://github.com/pypa/get-virtualenv/raw/20.0.31/public/virtualenv.pyz": "pkg:github/pypa/get-virtualenv@20.0.31#public/virtualenv.pyz", @@ -217,7 +219,6 @@ "https://github.com/downloads/mozilla/rhino/rhino1_7R4.zip" : "pkg:github/mozilla/rhino@1_7R4", "https://github.com/pombredanne/schematics.git" : "pkg:github/pombredanne/schematics", "https://github.com/jgoerzen/configfile/archive/upstream/1.1.4.tar.gz": "pkg:github/jgoerzen/configfile@1.1.4", - "https://codeload.github.com/berngp/grails-rest/zip/release/0.7": "pkg:github/berngp/grails-rest@release/0.7", "https://github.com/JetBrains/intellij-community/archive/idea/173.4710.11.zip": "pkg:github/jetbrains/intellij-community@173.4710.11", "https://github.com/knime/knime-core/archive/analytics-platform/3.6.0.zip": "pkg:github/knime/knime-core@3.6.0", "https://github.com/renozao/NMF/archive/hotfix/0.20.1.zip": "pkg:github/renozao/nmf@0.20.1",