Merge pull request #7730 from MikeMcQuaid/tap-fetch-name

tap: check for invalid fetched tap name.
This commit is contained in:
Mike McQuaid 2020-06-12 09:36:46 +01:00 committed by GitHub
commit fe75934acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,10 @@ class Tap
return CoreTap.instance if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
cache_key = "#{user}/#{repo}".downcase
cache.fetch(cache_key) { |key| cache[key] = Tap.new(user, repo) }
tap = cache.fetch(cache_key) { |key| cache[key] = Tap.new(user, repo) }
raise "Invalid tap name '#{args.join("/")}'" unless tap.path.to_s.match?(HOMEBREW_TAP_PATH_REGEX)
tap
end
def self.from_path(path)