mirror of https://github.com/tootsuite/mastodon
Allow @ at the end of an URL (#31124)
parent
5f5373397f
commit
887e64efd4
|
@ -9,7 +9,7 @@ module Twitter::TwitterText
|
||||||
|
|
||||||
class Regex
|
class Regex
|
||||||
REGEXEN[:valid_general_url_path_chars] = /[^\p{White_Space}<>()?]/iou
|
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] = /
|
REGEXEN[:valid_url_balanced_parens] = /
|
||||||
\(
|
\(
|
||||||
(?:
|
(?:
|
||||||
|
|
|
@ -224,6 +224,14 @@ RSpec.describe TextFormatter do
|
||||||
end
|
end
|
||||||
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
|
context 'when given a URL containing unsafe code (XSS attack, visible part)' do
|
||||||
let(:text) { 'http://example.com/b<del>b</del>' }
|
let(:text) { 'http://example.com/b<del>b</del>' }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue