Fixed: file uploads broken by r6312 (#8912).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6320 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-07-29 15:28:59 +00:00
parent ead5475001
commit 6db66f7183
2 changed files with 24 additions and 2 deletions
+2 -1
View File
@@ -74,7 +74,7 @@ class Attachment < ActiveRecord::Base
# and computes its MD5 hash
def before_save
if @temp_file && (@temp_file.size > 0)
logger.debug("saving '#{self.diskfile}'")
logger.info("Saving attachment '#{self.diskfile}' (#{@temp_file.size} bytes)")
md5 = Digest::MD5.new
File.open(diskfile, "wb") do |f|
buffer = ""
@@ -85,6 +85,7 @@ class Attachment < ActiveRecord::Base
end
self.digest = md5.hexdigest
end
@temp_file = nil
# 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