fix: fall back to root on an unrecognized URL path kind - #601
Open
eeshsaxena wants to merge 1 commit into
Open
Conversation
parse_remote_repo did PathKind(path_parts.pop(0)), which raises ValueError for any path segment that is not tree/blob/issues/pull. Valid GitHub URLs such as /releases/tag/v1.0, /wiki, /actions and /commits therefore crashed ingest() with an uncaught ValueError, while the known-but-unsupported issues and pull kinds already fall back to the repository root. Catch the ValueError and fall back to root as well.
Author
|
Hi! Gentle nudge on this one whenever you have some bandwidth. It's a small, self-contained fix ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
parse_remote_repocrashes on valid GitHub URLs whose path kind is nottree/blob/issues/pull:The line
kind = PathKind(path_parts.pop(0))raisesValueErrorfor any unrecognized segment, andingest_asynccallsparse_remote_repowithout catching it, so the whole ingest fails. Common URLs a user might paste hit this:/releases/...,/wiki,/actions,/commits/main,/security, etc.It is also inconsistent: the known-but-unsupported kinds (
issues,pull) already fall back to the repository root with a warning, but an unknown kind crashes instead.This catches the
ValueErrorand falls back to root the same way, so those URLs ingest the repository root instead of erroring. Added a regression test; the fullquery_parsersuite passes (40 tests).