Merge pull request #7735 from MikeMcQuaid/tap-new-restrict-names
tap-new: restrict new tap names.
This commit is contained in:
commit
ddf20bdc09
@ -22,7 +22,10 @@ module Homebrew
|
||||
def tap_new
|
||||
tap_new_args.parse
|
||||
|
||||
tap_name = args.named.first
|
||||
tap = Tap.fetch(args.named.first)
|
||||
raise "Invalid tap name '#{tap_name}'" unless tap.path.to_s.match?(HOMEBREW_TAP_PATH_REGEX)
|
||||
|
||||
titleized_user = tap.user.dup
|
||||
titleized_repo = tap.repo.dup
|
||||
titleized_user[0] = titleized_user[0].upcase
|
||||
|
||||
@ -34,10 +34,7 @@ class Tap
|
||||
return CoreTap.instance if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
|
||||
|
||||
cache_key = "#{user}/#{repo}".downcase
|
||||
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
|
||||
cache.fetch(cache_key) { |key| cache[key] = Tap.new(user, repo) }
|
||||
end
|
||||
|
||||
def self.from_path(path)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user