Commit 29413d6b authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Fixed: error when uploading a file with a content type longer than 60 chars.

(Maximum size changed to 255. Mime type not saved if longer)

git-svn-id: http://redmine.rubyforge.org/svn/trunk@739 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent fc64fc3e
......@@ -61,6 +61,10 @@ class Attachment < ActiveRecord::Base
end
self.digest = Digest::MD5.hexdigest(File.read(diskfile))
end
# Don't save the content type if it's longer than the authorized length
if self.content_type && self.content_type.length > 255
self.content_type = nil
end
end
# Deletes file on the disk
......
class ChangeAttachmentsContentTypeLimit < ActiveRecord::Migration
def self.up
change_column :attachments, :content_type, :string
end
def self.down
change_column :attachments, :content_type, :string, :limit => 60
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment