From 1ef8aeea493193afd228919b3e9ba60964a704c7 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Sun, 14 Jul 2024 13:04:06 -0400 Subject: [PATCH] resource_auditor: typechecking Signed-off-by: William Woodruff --- Library/Homebrew/resource_auditor.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/resource_auditor.rb b/Library/Homebrew/resource_auditor.rb index 7a208c95da..6e28607a41 100644 --- a/Library/Homebrew/resource_auditor.rb +++ b/Library/Homebrew/resource_auditor.rb @@ -109,7 +109,10 @@ module Homebrew return if name == owner.name # Skip the top-level package name as we only care about `resource "foo"` blocks. if url.end_with? ".whl" - pypi_package_name, = File.basename(URI(url).path).split("-", 2) + path = URI(url).path + return unless path.present? + + pypi_package_name, = File.basename(path).split("-", 2) else url =~ %r{/(?[^/]+)-} pypi_package_name = Regexp.last_match(:package_name).to_s.gsub(/[_.]/, "-")