mirror of https://github.com/Siphonay/mastodon
Allow @ at the end of an URL (#31124)
This commit is contained in:
parent
5f5373397f
commit
887e64efd4
|
@ -9,7 +9,7 @@ module Twitter::TwitterText
|
|||
|
||||
class Regex
|
||||
REGEXEN[:valid_general_url_path_chars] = /[^\p{White_Space}<>()?]/iou
|
||||
REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}()?!*"'「」<>;:=,.$%\[\]~&|@]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou
|
||||
REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}()?!*"'「」<>;:=,.$%\[\]~&|]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou
|
||||
REGEXEN[:valid_url_balanced_parens] = /
|
||||
\(
|
||||
(?:
|
||||
|
|
|
@ -224,6 +224,14 @@ RSpec.describe TextFormatter do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when given a URL with trailing @ symbol' do
|
||||
let(:text) { 'https://gta.fandom.com/wiki/TW@ Content' }
|
||||
|
||||
it 'matches the full URL' do
|
||||
expect(subject).to include 'href="https://gta.fandom.com/wiki/TW@"'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when given a URL containing unsafe code (XSS attack, visible part)' do
|
||||
let(:text) { 'http://example.com/b<del>b</del>' }
|
||||
|
||||
|
|
Loading…
Reference in New Issue