From 98e48a9da7b0f1444d95f942fb3c1804cbc80991 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Wed, 24 Jan 2018 07:00:41 -0800 Subject: [PATCH] bump-formula-pr: regex escape urls in replacements. --- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 1f60412ed4..ca3f4cfe89 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -232,12 +232,12 @@ module Homebrew end replacement_pairs += formula_spec.mirrors.map do |mirror| - [/ +mirror \"#{mirror}\"\n/m, ""] + [/ +mirror \"#{Regexp.escape(mirror)}\"\n/m, ""] end replacement_pairs += if new_url_hash [ - [formula_spec.url, new_url], + [/#{Regexp.escape(formula_spec.url)}/, new_url], [old_hash, new_hash], ] else @@ -250,7 +250,7 @@ module Homebrew backup_file = File.read(formula.path) unless ARGV.dry_run? if new_mirror - replacement_pairs << [/^( +)(url \"#{new_url}\"\n)/m, "\\1\\2\\1mirror \"#{new_mirror}\"\n"] + replacement_pairs << [/^( +)(url \"#{Regexp.escape(new_url)}\"\n)/m, "\\1\\2\\1mirror \"#{new_mirror}\"\n"] end if forced_version && forced_version != "0"