mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 08:15:00 +00:00
Prevent backtrace in PostAnalyser
This commit is contained in:
parent
86e5c9afc2
commit
96065a1499
@ -63,9 +63,14 @@ class PostAnalyzer
|
||||
|
||||
@linked_hosts = {}
|
||||
raw_links.each do |u|
|
||||
uri = URI.parse(u)
|
||||
host = uri.host
|
||||
@linked_hosts[host] ||= 1
|
||||
begin
|
||||
uri = URI.parse(u)
|
||||
host = uri.host
|
||||
@linked_hosts[host] ||= 1
|
||||
rescue URI::InvalidURIError
|
||||
# An invalid URI does not count as a raw link.
|
||||
next
|
||||
end
|
||||
end
|
||||
@linked_hosts
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user