summaryrefslogtreecommitdiffstats
path: root/app/models/attachment.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-29 15:28:59 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-29 15:28:59 +0000
commit6db66f71836862931d46f0f04e7aa4955b383e6e (patch)
treeca3500cb08ba55f06bb92247d3d7ff8bef4ee33f /app/models/attachment.rb
parentead54750014a260a280208012318e9ae10c55143 (diff)
downloadredmine-6db66f71836862931d46f0f04e7aa4955b383e6e.tar.gz
redmine-6db66f71836862931d46f0f04e7aa4955b383e6e.zip
Fixed: file uploads broken by r6312 (#8912).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6320 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/attachment.rb')
-rw-r--r--app/models/attachment.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 7e3a91581..d16d5cddf 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -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