Skip to content

Commit

Permalink
Fixes #37694 - Repo discovery should only return repos hosted under t…
Browse files Browse the repository at this point in the history
…he provided url tree (#11092)
  • Loading branch information
sjha4 authored Jul 31, 2024
1 parent 8ab0088 commit 89e7a9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/lib/katello/resources/discovery/yum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def run(resume_point)
if @uri.scheme == 'file'
crawl_file_path(uri(resume_point))
elsif %w(http https).include?(@uri.scheme)
spidr_crawl_pages(resume_point)
spidr_crawl_pages(uri(resume_point))
end
end

Expand Down Expand Up @@ -54,6 +54,7 @@ def spidr_proxy_details
end

def spidr_crawl_pages(url)
url = url.to_s
user, password = @upstream_username, @upstream_password
Spidr.site(url, proxy: spidr_proxy_details) do |spider|
spider.authorized.add(url, user, password) if user && password
Expand Down Expand Up @@ -85,8 +86,7 @@ def should_follow?(url)
# * link ends with '/' so it should be a directory
# * link doesn't end with '/Packages/', as this increases
# processing time and memory usage considerably

return url.hostname == @uri.hostname && !@crawled.include?(url.to_s) &&
return url.path.starts_with?(@uri.path) && url.hostname == @uri.hostname && !@crawled.include?(url.to_s) &&
url.path.ends_with?('/') && !url.path.ends_with?('/Packages/')
end
end
Expand Down

0 comments on commit 89e7a9c

Please sign in to comment.