diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-12-29 13:28:30 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-12-29 13:28:30 +0000 |
commit | ff7eb7b23a6aa86f4bc1a2d73ee0a3a4f1487ba7 (patch) | |
tree | ab6b2c2a4c24576a32bf193dad9cd934e4150a35 /app/models/attachment.rb | |
parent | b7b4e27833b08b07131d724aa4b1a411f2a13aa0 (diff) | |
download | redmine-ff7eb7b23a6aa86f4bc1a2d73ee0a3a4f1487ba7.tar.gz redmine-ff7eb7b23a6aa86f4bc1a2d73ee0a3a4f1487ba7.zip |
Auto-detect attachment content type when blank (#3782).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3258 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/attachment.rb')
-rw-r--r-- | app/models/attachment.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb index fe1d6afaa..e44b162ad 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -58,6 +58,9 @@ class Attachment < ActiveRecord::Base self.filename = sanitize_filename(@temp_file.original_filename) self.disk_filename = Attachment.disk_filename(filename) self.content_type = @temp_file.content_type.to_s.chomp + if content_type.blank? + self.content_type = Redmine::MimeType.of(filename) + end self.filesize = @temp_file.size end end |