small upload code refactor

This commit is contained in:
Régis Hanol
2015-02-03 18:44:18 +01:00
parent 91b3123e14
commit 0e5c9b2590
10 changed files with 89 additions and 105 deletions

View File

@ -224,7 +224,7 @@ module Email
# read attachment
File.open(tmp.path, "w+b") { |f| f.write attachment.body.decoded }
# create the upload for the user
upload = Upload.create_for(user.id, tmp, attachment.filename, File.size(tmp))
upload = Upload.create_for(user.id, tmp, attachment.filename, tmp.size)
if upload && upload.errors.empty?
# TODO: should use the same code as the client to insert attachments
raw << "\n#{attachment_markdown(upload)}\n"