Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid ARKs are not properly recognized by idutils #79

Open
huberrob opened this issue Feb 16, 2022 · 0 comments
Open

Valid ARKs are not properly recognized by idutils #79

huberrob opened this issue Feb 16, 2022 · 0 comments

Comments

@huberrob
Copy link

Package version (if known): idutils 1.1.11

Describe the bug

ARKs are not always recognized in particular when https is used as scheme and in case the new form of the ARK Label Part is used "ark:"instead of the old form, "ark:/". Further, https arks are not recognized

Steps to Reproduce

According to https://datatracker.ietf.org/doc/html/draft-kunze-ark-28#section-2.3
Valid ARKs are following the syntax https://NMA/]ark:[/]NAAN/Name[Qualifiers]

Therefore the following ARKS are valid but not recognized by idutils

Expected behavior

The ARKs listed above should be recognized

Screenshots (if applicable)

Additional context

A quick solution would be to change the regex:

ark_suffix_regexp = re.compile(r"ark:/?[0-9bcdfghjkmnpqrstvwxz]+/.+$")

and the is_ark method like this:

def is_ark(val):
    """Test if argument is an ARK."""
    res = urlparse(val)
    return ark_suffix_regexp.match(val) or (
        res.scheme in ['http','https'] and
        res.netloc != '' and
        # Note res.path includes leading slash, hence [1:] to use same reexp
        ark_suffix_regexp.match(res.path[1:]) and
        res.params == ''
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants