From d4b5b2080d2083580f482e8f7cd5745ca9ebdfe4 Mon Sep 17 00:00:00 2001 From: Martin Afanasjew Date: Wed, 27 Jul 2016 02:53:41 +0200 Subject: tap: more thoroughly validate tap names `Tap.fetch` and commands building on top of it accepted tap names like `homebrew/homebrew/bogus` causing some misbehavior. Ensure neither `user` nor `repo` include slashes and print a more helpful error message that additionally includes the problematic tap name. Closes #585. Closes #591. Signed-off-by: Martin Afanasjew --- Library/Homebrew/tap.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index e77390ab1..a564b3170 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -25,7 +25,9 @@ class Tap repo = args[1] end - raise "Invalid tap name" unless user && repo + if [user, repo].any? { |part| part.nil? || part.include?("/") } + raise "Invalid tap name '#{args.join("/")}'" + end # we special case homebrew so users don't have to shift in a terminal user = "Homebrew" if user == "homebrew" -- cgit v1.2.3