tap-new: restrict new tap names.
Don't want to restrict this for all taps otherwise existing ones may explode. Fixes #7734
This commit is contained in:
		
							parent
							
								
									91b4d45070
								
							
						
					
					
						commit
						f94a38e4b1
					
				@ -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