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

Bug(graphene): extract_graphene_path doesn't parse URI segment prefixes #462

Open
nkemnitz opened this issue Apr 21, 2021 · 1 comment
Open
Labels
redesign It may be flawed, but the code was working as designed.

Comments

@nkemnitz
Copy link
Contributor

At Zetta, we have a number of ChunkedGraphs under the same subdomain, but with some additional prefixes, e.g graphene://https://sub.domain.xyz/some_prefix/segmentation/table/dataset_name which results in a UnsupportedFormatError: Unable to parse Graphene URL: https://sub.domain.xyz/some_prefix/segmentation/table/dataset_name error.

I think the current regex is stumbling over the additional /some_prefix in the URL:

LATEST_API_EXTRACTION_RE = re.compile(r'/?(\w+)/(table)/([\w\d\.\_\-]+)/?')

It only scans for a single segment before /table, but I am not sure if that's intentional, or a bug? At least I don't see why the limitation would be necessary.

@william-silversmith william-silversmith added the redesign It may be flawed, but the code was working as designed. label Apr 22, 2021
@william-silversmith
Copy link
Contributor

The reason the regexp is failing is because it's being invoked as re.match instead of re.search. match only matches from the start of a string. The regexp could be augmented to match more elements. I'm a bit wary of allowing arbitrary matches anywhere in the string as that could unlock all kinds of weird edge cases. I can accept a PR with changes in that direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
redesign It may be flawed, but the code was working as designed.
Projects
None yet
Development

No branches or pull requests

2 participants