mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: Respect blocked domains list when redirecting (#15656)
Our previous implementation used a simple `blocked_domain_array.include?(hostname)` so some values were not matching. Additionally, in some configurations like ours, we'd used "cat.*.dog.com" with the assumption we'd support globbing. This change implicitly allows globbing by blocking "http://a.b.com" if "b.com" is a blocked domain but does not actively do anything for "*". An upcoming change might include frontend validation for values that can be inserted.
This commit is contained in:
@ -60,6 +60,10 @@ module RetrieveTitle
|
||||
encoding = nil
|
||||
|
||||
fd.get do |_response, chunk, uri|
|
||||
if (uri.present? && InlineOneboxer.domain_is_blocked?(uri.hostname))
|
||||
throw :done
|
||||
end
|
||||
|
||||
unless Net::HTTPRedirection === _response
|
||||
if current
|
||||
current << chunk
|
||||
|
Reference in New Issue
Block a user