From 7dca9a13ee59b55e4074770090127ebd6787267e Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Fri, 9 Jun 2017 11:44:25 -0700 Subject: [PATCH] BottleLoader: Fix installing a bottle from an URL The name of the formula is not extracted correctly when the URL includes a hyphen. --- Library/Homebrew/formulary.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index a0ccb9ba03..195d15cece 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -108,7 +108,8 @@ module Formulary case bottle_name when %r{(https?|ftp|file)://} # The name of the formula is found between the last slash and the last hyphen. - resource = Resource.new bottle_name[%r{([^/]+)-}, 1] { url bottle_name } + formula_name = File.basename(bottle_name)[/(.+)-/, 1] + resource = Resource.new(formula_name) { url bottle_name } downloader = CurlBottleDownloadStrategy.new resource.name, resource @bottle_filename = downloader.cached_location cached = @bottle_filename.exist?