Skip to content

Commit

Permalink
match with url host instead of string
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron-212 committed May 26, 2024
1 parent 7da9ea0 commit 73ead3e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Library/Homebrew/cask/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ def audit_download_url_format
add_error "SourceForge URL format incorrect. See #{Formatter.url(SOURCEFORGE_OSDN_REFERENCE_URL)}",
location: cask.url.location
elsif bad_osdn_url?
add_error "OSDN URLs are disabled.",
location: cask.url.location
add_error "OSDN download urls are disabled.", location: cask.url.location, strict_only: true
end
end

Expand Down Expand Up @@ -895,7 +894,7 @@ def bad_sourceforge_url?

sig { returns(T::Boolean) }
def bad_osdn_url?
cask.url.to_s.match?(%r{^(?:https?://)?(?:\w+\.)*osdn\.jp(?=/|$)})
URI(cask.url.to_s).host.match?(%r{^(?:\w+\.)*osdn\.jp(?=/|$)})
end

# sig { returns(String) }
Expand Down

0 comments on commit 73ead3e

Please sign in to comment.