mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-25 15:38:06 +01:00
Allow @ at the end of an URL (#31124)
This commit is contained in:
parent
5f5373397f
commit
887e64efd4
2 changed files with 9 additions and 1 deletions
|
@ -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 a new issue