Skip to content
Snippets Groups Projects
Unverified Commit 91fb49d2 authored by Xu Cheng's avatar Xu Cheng
Browse files

various: proper escape in regex

parent 48a1e1b4
No related branches found
No related tags found
No related merge requests found
......@@ -142,7 +142,7 @@ class FormulaAuditor
swig
]
FILEUTILS_METHODS = FileUtils.singleton_methods(false).join "|"
FILEUTILS_METHODS = FileUtils.singleton_methods(false).map { |m| Regexp.escape(m) }.join "|"
def initialize(formula, options = {})
@formula = formula
......
......@@ -238,7 +238,7 @@ module Homebrew
ignores = []
if f.deps.any? { |dep| dep.name == "go" }
ignores << %r{#{HOMEBREW_CELLAR}/go/[\d\.]+/libexec}
ignores << %r{#{Regexp.escape(HOMEBREW_CELLAR)}/go/[\d\.]+/libexec}
end
if ARGV.include? "--skip-relocation"
......
......@@ -110,7 +110,7 @@ class FormulaCreator
when %r{github\.com/\S+/(\S+)/archive/}
@name = $1
else
/(.*?)[-_.]?#{path.version}/.match path.basename
/(.*?)[-_.]?#{Regexp.escape(path.version)}/.match path.basename
@name = $1
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment