From 02f1c04fabab221130de8dfb5611be81825b193b Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 22 Mar 2020 17:56:49 +0100 Subject: Make sanitizer *not* add no-referrer etc. in local markdown toots if the link is “safe” MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/lib/sanitize_config_spec.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'spec/lib/sanitize_config_spec.rb') diff --git a/spec/lib/sanitize_config_spec.rb b/spec/lib/sanitize_config_spec.rb index 2d82c00ea..7370c536b 100644 --- a/spec/lib/sanitize_config_spec.rb +++ b/spec/lib/sanitize_config_spec.rb @@ -7,6 +7,12 @@ describe Sanitize::Config do describe '::MASTODON_STRICT' do subject { Sanitize::Config::MASTODON_STRICT } + around do |example| + original_web_domain = Rails.configuration.x.web_domain + example.run + Rails.configuration.x.web_domain = original_web_domain + end + it 'keeps h1' do expect(Sanitize.fragment('

Foo

', subject)).to eq '

Foo

' end @@ -32,7 +38,12 @@ describe Sanitize::Config do end it 'keeps a with href and rel tag' do - expect(Sanitize.fragment('', subject)).to eq 'Test' + expect(Sanitize.fragment('', subject)).to eq 'Test' + end + + it 'keeps a with href and rel tag, not adding to rel if url is local' do + Rails.configuration.x.web_domain = 'domain.test' + expect(Sanitize.fragment('', subject.merge(outgoing: true))).to eq '' end end end -- cgit