Skip to content

Commit

Permalink
Fix crash on startup if hosts blacklist is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
amatriain committed Jan 22, 2021
1 parent a2d37f3 commit 3cf0803
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions config/initializers/hosts_blacklist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@

# Store in the blacklist the host for each line, which is what we're interested in
blacklist = []
list['hosts'].each do |url|
blacklisted_url = UrlNormalizer.normalize_feed_url(url).downcase
blacklisted_host = Addressable::URI.parse(blacklisted_url).host
blacklist << blacklisted_host
if list['hosts'].present?
list['hosts'].each do |url|
blacklisted_url = UrlNormalizer.normalize_feed_url(url).downcase
blacklisted_host = Addressable::URI.parse(blacklisted_url).host
blacklist << blacklisted_host
end
end

Rails.application.config.hosts_blacklist = blacklist

0 comments on commit 3cf0803

Please sign in to comment.