From d095dbcc1454beeb98aa4ab99ca1ee8754675bbf Mon Sep 17 00:00:00 2001 From: f Date: Wed, 1 Feb 2023 17:51:30 -0300 Subject: [PATCH] fix: usar HTML5 --- app/models/metadata_content.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/metadata_content.rb b/app/models/metadata_content.rb index 1664a18f..761518e8 100644 --- a/app/models/metadata_content.rb +++ b/app/models/metadata_content.rb @@ -24,7 +24,7 @@ class MetadataContent < MetadataTemplate end def to_s - Nokogiri::HTML.fragment(value).tap do |html| + Nokogiri::HTML5.fragment(value).tap do |html| html.css('[src^="public/"]').each do |element| element['src'] = convert_internal_path_to_src element['src'] end @@ -46,7 +46,7 @@ class MetadataContent < MetadataTemplate # TODO: En lugar de comprobar el Content Type acá, restringir los # tipos de archivo a aceptar en ActiveStorage. def sanitize(html_string) - html = Nokogiri::HTML.fragment(super html_string) + html = Nokogiri::HTML5.fragment(super html_string) elements = 'img,audio,video,iframe' # Eliminar elementos sin src y comprobar su origen