Handle raw GitHub URLs containing refs/heads/ #4263
Merged
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.
Problem
HideEmptyFilters
currently has an inflation warning about failing to download a remote version file that most definitely exists.Cause
Once upon a time, if you clicked the "raw" link in GitHub, it took you to a URL like this:
Now it does this instead:
Note the extra
refs/heads/
substring that's been added.GithubApi.TryGetGithubPath
tries to parse GitHub URLs in order to access the same files via the GitHub API, and this new substring messes up the existing parsing. It thinks the branch is calledrefs
and that the file's path starts withheads/main
. When these erroneous strings are passed to the API, the retrieval fails.Changes
Now
GithubApi.TryGetGitHubPath
skipsrefs/heads/
if it is present in a URL. This allows it to get the correct branch, and therefore also download the file successfully, which fixes the 404.FYI to @AlexSkylark.