Fixes #2107 - Too large article body fails imports.
This commit is contained in:
parent
6bf588dd0c
commit
fe5a9cfcc1
2 changed files with 11 additions and 1 deletions
|
@ -304,7 +304,7 @@ returns
|
|||
current_length = body.length
|
||||
return true if body.length <= limit
|
||||
|
||||
raise Exceptions::UnprocessableEntity, "body of article is too large, #{current_length} chars - only #{limit} allowed" if !ApplicationHandleInfo.postmaster?
|
||||
raise Exceptions::UnprocessableEntity, "body of article is too large, #{current_length} chars - only #{limit} allowed" if !ApplicationHandleInfo.postmaster? && !Setting.get('import_mode')
|
||||
|
||||
logger.warn "WARNING: cut string because of database length #{self.class}.body(#{limit} but is #{current_length})"
|
||||
self.body = body[0, limit]
|
||||
|
|
|
@ -256,6 +256,16 @@ RSpec.describe Ticket::Article, type: :model do
|
|||
end
|
||||
end
|
||||
|
||||
context 'for import' do
|
||||
before do
|
||||
Setting.set('import_mode', true)
|
||||
end
|
||||
|
||||
it 'truncates body to 1.5 million chars' do
|
||||
expect(article.body.length).to eq(1_500_000)
|
||||
end
|
||||
end
|
||||
|
||||
context 'for "test.postmaster" thread', application_handle: 'test.postmaster' do
|
||||
it 'truncates body to 1.5 million chars' do
|
||||
expect(article.body.length).to eq(1_500_000)
|
||||
|
|
Loading…
Reference in a new issue