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

Handle raw GitHub URLs containing refs/heads/ #4263

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Nov 21, 2024

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 called refs and that the file's path starts with heads/main. When these erroneous strings are passed to the API, the retrieval fails.

Changes

Now GithubApi.TryGetGitHubPath skips refs/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.

@HebaruSan HebaruSan added Bug Something is not working as intended Easy This is easy to fix Netkan Issues affecting the netkan data Network Issues affecting internet connections of CKAN labels Nov 21, 2024
@HebaruSan HebaruSan merged commit 9246150 into KSP-CKAN:master Nov 21, 2024
3 checks passed
@HebaruSan HebaruSan deleted the fix/gh-raw-url-refs-heads branch November 21, 2024 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended Easy This is easy to fix Netkan Issues affecting the netkan data Network Issues affecting internet connections of CKAN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant