Skip to content

Git Download Location regex matcher doesn't meet spec #53

@ianling

Description

@ianling

Spec: https://spdx.github.io/spdx-spec/3-package-information/#37-package-download-location

Code:

private static final String GIT_PATTERN = "(git\\+git@[a-zA-Z0-9\\.]+:[a-zA-Z0-9]+)";

Here is a link to a bunch of test cases that should work according to the spec, but do not: https://regex101.com/r/mb4tWm/1

For reference in case that link dies, here's a summary of ones that do and do not work:

git://git.myproject.org/MyProject.git@master ✅
git://git.myproject.org/MyOrg/MyProject.git@master ✅
git+git@git.myproject.org:MyProject ✅
git+git@git.myproject.org:MyOrg/MyProject ❌
git+git@git.myproject.org:MyProject.git ❌
git+git@git.myproject.org:MyOrg/MyProject.git ❌
git+git@git.myproject.org:MyProject@main ❌
git+git@git.myproject.org:MyProject@6338c7a2525e055a05bae1580e4dd189c2feff7b ❌

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions