tap: check for invalid fetched tap name.

Fixes #7732.
This commit is contained in:
Mike McQuaid 2020-06-12 09:04:37 +01:00
parent c120b61204
commit 5acb592779
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

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)