diff options
| author | Kevin Abel | 2018-02-12 14:22:10 -0600 |
|---|---|---|
| committer | Kevin Abel | 2018-02-12 14:22:10 -0600 |
| commit | ca3fccaf2b4bfe5c4d96a17ac5559f3721d00230 (patch) | |
| tree | 237cd536ecb472e3521c8e2b29430af159224d09 /Library | |
| parent | 601af55b43bc96627359eca06eeec4bf9881c890 (diff) | |
| download | brew-ca3fccaf2b4bfe5c4d96a17ac5559f3721d00230.tar.bz2 | |
Make ext use bounded iterator
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index ed316fa7f..e85661d76 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -303,12 +303,11 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy # We can't use basename_without_params, because given a URL like # https://example.com/download.php?file=foo-1.0.tar.gz # the extension we want is ".tar.gz", not ".php". - url_pathname = Pathname.new(@url) - until ext = url_pathname.extname[/[^?]+/] - url_pathname = url_pathname.dirname - return if url_pathname.to_s == "." || url_pathname.to_s == "/" + Pathname.new(@url).ascend do |path| + ext = path.extname[/[^?]+/] + return ext if ext end - ext + nil end end |
