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.
(maint) Fix git remote detection
Previously, this was attempting to determine if a github.com URL was a remote or a media type by inspecting part of the path. However, this was missing paths with 'release' in them. Also, we were never actually using any other return type but :github_remote. This changes the logic to return :github_media if the path contains known media tokens, or if the suffix ends with .tar.gz or .zip. Otherwise, we assume it's a remote.
Ideally, we'd reach out to GitHub to determine if it's a repo, but we're doing this to avoid rate limiting.
(maint) Fix valid_url? check
Because the 'request' function does NOT return the value the block you pass it returns, this function was always returning a Net::HTTP object. With how this function was being used, it would result in valid_url? always being truthy. Net::HTTP.start DOES return the value that the block you pass it returns, though, so this simply un-blockifies the processing of the request response.