aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorJack Nagel2014-07-06 11:24:24 -0500
committerJack Nagel2014-07-06 11:25:56 -0500
commitf8fb74ff76f4f6b779bcaccee94bdb442f2ea51a (patch)
treef9bd9c443bde2055734bc4132e48031d3fc601c5 /Library/Homebrew/cmd
parent7e268670ed4e2dec9a83cb8a79295135fb1c2110 (diff)
downloadbrew-f8fb74ff76f4f6b779bcaccee94bdb442f2ea51a.tar.bz2
Escape paths in regexps
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/tap.rb2
-rw-r--r--Library/Homebrew/cmd/update.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb
index d13921572..3fb5ca65c 100644
--- a/Library/Homebrew/cmd/tap.rb
+++ b/Library/Homebrew/cmd/tap.rb
@@ -123,7 +123,7 @@ module Homebrew
case path.to_s
when HOMEBREW_TAP_PATH_REGEX
"#$1/#$2/#{File.basename($3, '.rb')}"
- when %r{^#{HOMEBREW_LIBRARY}/Formula/(.+)}
+ when %r{^#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Formula/(.+)}o
"Homebrew/homebrew/#{File.basename($1, '.rb')}"
else
nil
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb
index 7bced13a9..b1ee8d8fe 100644
--- a/Library/Homebrew/cmd/update.rb
+++ b/Library/Homebrew/cmd/update.rb
@@ -266,7 +266,7 @@ class Report
def select_formula key
fetch(key, []).map do |path|
case path.to_s
- when Regexp.new(HOMEBREW_LIBRARY + "/Formula")
+ when %r{^#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Formula}o
path.basename(".rb").to_s
when HOMEBREW_TAP_PATH_REGEX
"#$1/#{$2.sub("homebrew-", "")}/#{path.basename(".rb")}"