aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Afanasjew2016-07-27 02:53:41 +0200
committerMartin Afanasjew2016-07-27 21:25:13 +0200
commitd4b5b2080d2083580f482e8f7cd5745ca9ebdfe4 (patch)
tree9dd510b7f8ff9b5b0b9f0f16b8549821735272b2
parent54d1e99ffe5046209ade523017cd84dd4394e0f5 (diff)
downloadbrew-d4b5b2080d2083580f482e8f7cd5745ca9ebdfe4.tar.bz2
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 <martin@afanasjew.de>
-rw-r--r--Library/Homebrew/tap.rb4
1 files changed, 3 insertions, 1 deletions
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"