Fix GitHub archive URL for packages #309
Open
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.
When registering new packages, the GitHub archive URL includes a slash at the end. This works in most situations as
github.com
is lenient about forwarding requests with or without the slash tocodeload.github.com
, however, it can cause issues with some caching proxies.Taking elm/html as an example, archive URLs with or without the slash redirect correctly:
However, when using a caching proxy like Artifactory (which is unfortunately often a requirement when building software in large enterprises) we can run into the following issue:
This is because the slash makes Artifactory thinks the request is for a directory. As nothing has been cached within that directory, it returns an error saying the directory doesn't exist. Even if you force it to cache the file then it will still reject requests because it has cached a file under that path instead of a directory. Dropping the slash on the archive URLs fixes the problem.
From what I can tell, this only solves the problem for new packages. If this gets accepted and rolled out, the next question is whether you're open to editing the package database to drop the slashes on all the existing packages.