5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-17 08:16:29 +00:00

fix: eliminar el elemento sin src válido en un solo lugar

This commit is contained in:
f 2023-02-01 17:09:58 -03:00
parent 5611042c58
commit ecff604c8e

View file

@ -47,16 +47,13 @@ class MetadataContent < MetadataTemplate
# Eliminar elementos sin src y comprobar su origen
html.css(elements).each do |element|
unless element['src']
element.remove
next
end
begin
raise URI::Error unless element['src'].present?
uri = URI element['src']
# No permitimos recursos externos
element.remove unless uri.scheme == 'https' && uri.hostname.end_with?(Site.domain)
raise URI::Error unless Rails.application.config.hosts.include?(uri.hostname)
rescue URI::Error
element.remove
end