Revision description length validation limited to 1KB

This commit is contained in:
Karel Picman 2018-03-15 10:32:10 +01:00
parent a8ce29e2c0
commit 393f0d3236
2 changed files with 3 additions and 3 deletions

View File

@ -68,7 +68,7 @@ class DmsfFileRevision < ActiveRecord::Base
validates :title, :presence => true
validates_format_of :name, :with => DmsfFolder::INVALID_CHARACTERS,
:message => l(:error_contains_invalid_character)
validates :description, length: { maximum: 1.megabyte }
validates :description, length: { maximum: 1.kilobyte }
def project
self.dmsf_file.project if self.dmsf_file

View File

@ -183,9 +183,9 @@ class DmsfFileRevisionTest < RedmineDmsf::Test::UnitTest
end
def test_description_max_length
@revision1.description = 'a' * 2.megabytes
@revision1.description = 'a' * 2.kilobytes
assert !@revision1.save
@revision1.description = 'a' * 1.megabyte
@revision1.description = 'a' * 1.kilobyte
assert @revision1.save
end