diff options
-rw-r--r-- | db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb | 9 | ||||
-rw-r--r-- | test/unit/attachment_test.rb | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb b/db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb new file mode 100644 index 000000000..a58e57183 --- /dev/null +++ b/db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb @@ -0,0 +1,9 @@ +class ChangeAttachmentsFilesizeLimitTo8 < ActiveRecord::Migration + def self.up + change_column :attachments, :filesize, :integer, :limit => 8, :default => 0, :null => false + end + + def self.down + change_column :attachments, :filesize, :integer, :limit => 4, :default => 0, :null => false + end +end diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb index ac09f5658..eaaa1459f 100644 --- a/test/unit/attachment_test.rb +++ b/test/unit/attachment_test.rb @@ -111,6 +111,17 @@ class AttachmentTest < ActiveSupport::TestCase end end + def test_filesize_greater_than_2gb_should_be_supported + with_settings :attachment_max_size => (50.gigabyte / 1024) do + a = Attachment.create!(:container => Issue.find(1), + :file => uploaded_test_file("testfile.txt", "text/plain"), + :author => User.find(1)) + a.filesize = 20.gigabyte + a.save! + assert_equal 20.gigabyte, a.reload.filesize + end + end + def test_description_length_should_be_validated a = Attachment.new(:description => 'a' * 300) assert !a.save |