Fix being able to post URLs longer than 4096 characters (#17908)
This commit is contained in:
parent
5554ff2a1d
commit
bbc7afa2a2
3 changed files with 57 additions and 14 deletions
|
@ -50,6 +50,13 @@ describe StatusLengthValidator do
|
|||
expect(status.errors).to have_received(:add)
|
||||
end
|
||||
|
||||
it 'does not count overly long URLs as 23 characters flat' do
|
||||
text = "http://example.com/valid?#{'#foo?' * 1000}"
|
||||
status = double(spoiler_text: '', text: text, errors: double(add: nil), local?: true, reblog?: false)
|
||||
subject.validate(status)
|
||||
expect(status.errors).to have_received(:add)
|
||||
end
|
||||
|
||||
it 'counts only the front part of remote usernames' do
|
||||
text = ('a' * 475) + " @alice@#{'b' * 30}.com"
|
||||
status = double(spoiler_text: '', text: text, errors: double(add: nil), local?: true, reblog?: false)
|
||||
|
@ -57,5 +64,13 @@ describe StatusLengthValidator do
|
|||
subject.validate(status)
|
||||
expect(status.errors).to_not have_received(:add)
|
||||
end
|
||||
|
||||
it 'does count both parts of remote usernames for overly long domains' do
|
||||
text = "@alice@#{'b' * 500}.com"
|
||||
status = double(spoiler_text: '', text: text, errors: double(add: nil), local?: true, reblog?: false)
|
||||
|
||||
subject.validate(status)
|
||||
expect(status.errors).to have_received(:add)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue