diff --git a/Library/Homebrew/livecheck/livecheck.rb b/Library/Homebrew/livecheck/livecheck.rb index 9a1bf3e225..87114521df 100644 --- a/Library/Homebrew/livecheck/livecheck.rb +++ b/Library/Homebrew/livecheck/livecheck.rb @@ -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