Skip to content

Download Location regex error #38

@riyenas0925

Description

@riyenas0925

Describe the bug

If the download location is http://www.google.com, error when converting SPDX.

Caused by: org.spdx.library.InvalidSPDXAnalysisException: Invalid download location pattern http://www.google.com. Must match the pattern ^(NONE|NOASSERTION|(((git|hg|svn|bzr)\+)?(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/|ssh:\/\/|git:\/\/|svn:\/\/|sftp:\/\/|ftp:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+){0,100}\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*))|(git\+git@[a-zA-Z0-9\.]+:[a-zA-Z0-9/\\.@]+)|(bzr\+lp:[a-zA-Z0-9\.]+))$
web_1  | 	at org.spdx.library.model.SpdxPackage.setDownloadLocation(SpdxPackage.java:239)
web_1  | 	at org.spdx.library.model.SpdxPackage.<init>(SpdxPackage.java:111)
web_1  | 	at org.spdx.library.model.SpdxPackage$SpdxPackageBuilder.build(SpdxPackage.java:1036)
web_1  | 	at org.spdx.spreadsheetstore.PackageInfoSheetV2d2.getPackage(PackageInfoSheetV2d2.java:550)
web_1  | 	... 81 common frames omitted

SPDX Download location Specification

IMHO, the spec doesn't seem to say that a trailing slash is mandatory.

In VCS location compact notations, 
the trailing slashes in <host_name>, <path_to_repository> are not significant. 
Leading and trailing slashes in <sub_path> are not significant.

download location regular expression

This is the download location regular expression currently used by spdx-tools-java.

^(NONE|NOASSERTION|(((git|hg|svn|bzr)\+)?(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/|ssh:\/\/|git:\/\/|svn:\/\/|sftp:\/\/|ftp:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+){0,100}\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*))|(git\+git@[a-zA-Z0-9\.]+:[a-zA-Z0-9/\\.@]+)|(bzr\+lp:[a-zA-Z0-9\.]+))$

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