Skip to content

Commit

Permalink
Merge pull request #18631 from Homebrew/sf-fixes
Browse files Browse the repository at this point in the history
rubocops/shared/url_helper: tweak SourceForge handling
  • Loading branch information
Bo98 authored Oct 24, 2024
2 parents 3b52a46 + 3292dc3 commit 5538282
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Library/Homebrew/rubocops/shared/url_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def audit_url(type, urls, mirrors, livecheck_url: false)
%r{^http://hackage\.haskell\.org/},
%r{^http://(?:[^/]*\.)?archive\.org},
%r{^http://(?:[^/]*\.)?freedesktop\.org},
%r{^http://(?:[^/]*\.)?mirrorservice\.org/}])
%r{^http://(?:[^/]*\.)?mirrorservice\.org/},
%r{^http://downloads?\.sourceforge\.net/}])
audit_urls(urls, http_to_https_patterns) do |_, url, index|
# It's fine to have a plain HTTP mirror further down the mirror list.
https_url = url.dup.insert(4, "s")
Expand Down Expand Up @@ -153,7 +154,7 @@ def audit_url(type, urls, mirrors, livecheck_url: false)

problem "Don't use /download in SourceForge urls (url is #{url})." if url.end_with?("/download")

if url.match?(%r{^https?://sourceforge\.}) && url != livecheck_url
if url.match?(%r{^https?://(sourceforge|sf)\.}) && url != livecheck_url
problem "Use https://downloads.sourceforge.net to get geolocation (url is #{url})."
end

Expand All @@ -165,7 +166,10 @@ def audit_url(type, urls, mirrors, livecheck_url: false)
problem "Don't use specific dl mirrors in SourceForge urls (url is #{url})."
end

problem "Please use https:// for #{url}" if url.start_with? "http://downloads"
# sf.net does HTTPS -> HTTP redirects.
if url.match?(%r{^https?://downloads?\.sf\.net})
problem "Use https://downloads.sourceforge.net instead of downloads.sf.net (url is #{url})"
end
end

# Debian has an abundance of secure mirrors. Let's not pluck the insecure
Expand Down

0 comments on commit 5538282

Please sign in to comment.