Livecheck#preprocess_url: compare with URI host
We now have a `gitea` formula in homebrew/core and its `stable` URL uses a dl.gitea.com tarball. Since the URL's domain is gitea.com, livecheck tries to preprocess the URL into a `.git` URL but the resulting URL doesn't work because it's not a Git repository. Gitea repositories use gitea.com (with no subdomain), so `#preprocess_url` should be comparing the URI host (`dl.gitea.com`) instead of the domain (`gitea.com`). This change allows gitea.com repository URLs to continue to be preprocessed into a `.git` URL while dl.gitea.com URLs are left untouched. This makes the same change for the other domains, as they don't use a subdomain either.
This commit is contained in:
parent
b53508897b
commit
88109b16c3
@ -561,25 +561,24 @@ module Homebrew
|
||||
end
|
||||
|
||||
host = uri.host
|
||||
domain = uri.domain
|
||||
path = uri.path
|
||||
return url if host.nil? || path.nil?
|
||||
|
||||
domain = host = "github.com" if host == "github.s3.amazonaws.com"
|
||||
host = "github.com" if host == "github.s3.amazonaws.com"
|
||||
path = path.delete_prefix("/").delete_suffix(".git")
|
||||
scheme = uri.scheme
|
||||
|
||||
if domain == "github.com"
|
||||
if host == "github.com"
|
||||
return url if path.match? %r{/releases/latest/?$}
|
||||
|
||||
owner, repo = path.delete_prefix("downloads/").split("/")
|
||||
url = "#{scheme}://#{host}/#{owner}/#{repo}.git"
|
||||
elsif GITEA_INSTANCES.include?(domain)
|
||||
elsif GITEA_INSTANCES.include?(host)
|
||||
return url if path.match? %r{/releases/latest/?$}
|
||||
|
||||
owner, repo = path.split("/")
|
||||
url = "#{scheme}://#{host}/#{owner}/#{repo}.git"
|
||||
elsif GOGS_INSTANCES.include?(domain)
|
||||
elsif GOGS_INSTANCES.include?(host)
|
||||
owner, repo = path.split("/")
|
||||
url = "#{scheme}://#{host}/#{owner}/#{repo}.git"
|
||||
# sourcehut
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user