diff --git a/app/services/wordpress.rb b/app/services/wordpress.rb index a34aaf0522cc0c82e076246b4d17078e88acc9ab..bc2f68752d4d240a9a6da04c6792899f4e718235 100644 --- a/app/services/wordpress.rb +++ b/app/services/wordpress.rb @@ -1,7 +1,15 @@ class Wordpress attr_reader :domain - def self.clean(html) + + def self.clean_string(string) + string = string.gsub(' ', ' ') + string = string.gsub('&', '&') + string = ActionView::Base.full_sanitizer.sanitize string + string + end + + def self.clean_html(html) # Relaxed config : https://github.com/rgrove/sanitize/blob/main/lib/sanitize/config/relaxed.rb fragment = Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::RELAXED, attributes: Sanitize::Config::RELAXED[:attributes].merge({ diff --git a/test/models/communication/website/imported/medium_test.rb b/test/models/communication/website/imported/medium_test.rb deleted file mode 100644 index 5add977a92c6d842975348429524d1ddfbfec935..0000000000000000000000000000000000000000 --- a/test/models/communication/website/imported/medium_test.rb +++ /dev/null @@ -1,32 +0,0 @@ -# == Schema Information -# -# Table name: communication_website_imported_media -# -# id :uuid not null, primary key -# data :jsonb -# file_url :text -# filename :string -# identifier :string -# mime_type :string -# created_at :datetime -# updated_at :datetime -# university_id :uuid not null -# website_id :uuid not null -# -# Indexes -# -# index_communication_website_imported_media_on_university_id (university_id) -# index_communication_website_imported_media_on_website_id (website_id) -# -# Foreign Keys -# -# fk_rails_... (university_id => universities.id) -# fk_rails_... (website_id => communication_website_imported_websites.id) -# -require "test_helper" - -class Communication::Website::Imported::MediumTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/wordpress_test.rb b/test/models/wordpress_test.rb index 23b1323b6ad65b5630818d4501b8328365423576..24a52105065998323c288470a1937e894eb23424 100644 --- a/test/models/wordpress_test.rb +++ b/test/models/wordpress_test.rb @@ -57,7 +57,7 @@ class WordpressTest < ActiveSupport::TestCase test "convert in titles" do assert_equal ' ', - Wordpress.clean_string ' ' + Wordpress.clean_string(' ') end test "authorize iframes" do