parent
543bb64629
commit
654be99637
|
@ -133,7 +133,7 @@ class Sanitize
|
|||
rel += ['nofollow', 'noopener', 'noreferrer'] unless TagManager.instance.local_url?(node['href'])
|
||||
|
||||
if rel.empty?
|
||||
node['rel']&.delete
|
||||
node.remove_attribute('rel')
|
||||
else
|
||||
node['rel'] = rel.join(' ')
|
||||
end
|
||||
|
@ -144,7 +144,7 @@ class Sanitize
|
|||
|
||||
node = env[:node]
|
||||
if node['target'] != '_blank' && TagManager.instance.local_url?(node['href'])
|
||||
node['target']&.delete
|
||||
node.remove_attribute('target')
|
||||
else
|
||||
node['target'] = '_blank'
|
||||
end
|
||||
|
|
|
@ -50,6 +50,14 @@ RSpec.describe AdvancedTextFormatter do
|
|||
end
|
||||
end
|
||||
|
||||
context 'given text with a local-domain mention' do
|
||||
let(:text) { 'foo https://cb6e6126.ngrok.io/about/more' }
|
||||
|
||||
it 'creates a link' do
|
||||
is_expected.to include '<a href="https://cb6e6126.ngrok.io/about/more"'
|
||||
end
|
||||
end
|
||||
|
||||
context 'given text containing linkable mentions' do
|
||||
let(:preloaded_accounts) { [Fabricate(:account, username: 'alice')] }
|
||||
let(:text) { '@alice' }
|
||||
|
|
Loading…
Reference in New Issue