Browse files

compatibility with rails 3

  • Loading branch information...
1 parent 9de4489 commit 7728bfe285f8ae809fa337313b209339d7fcced5 @amartel committed Oct 25, 2012
Showing with 8 additions and 7 deletions.
  1. BIN extra/redmine_http_auth.tgz
  2. +8 −7 lib/file_resource.rb
View
BIN extra/redmine_http_auth.tgz
Binary file not shown.
View
15 lib/file_resource.rb
@@ -465,12 +465,13 @@ def self.write_content_to_path(project, path, content)
if file
container.attachments.delete(file)
end
- uploaded_file = ActionController::UploadedTempfile.new(pinfo.last)
- uploaded_file.binmode
- uploaded_file.write(content)
- # uploaded_file.flush
- uploaded_file.original_path = pinfo.last
- uploaded_file.rewind
+
+ tmpfile = Tempfile.new(pinfo.last)
+ tmpfile.binmode
+ tmpfile.write(content)
+ tmpfile.rewind
+ uploaded_file = ActionDispatch::Http::UploadedFile.new({:filename => pinfo.last, :tempfile => tmpfile})
+
a = Attachment.create(:container => container,
:webdavfile => uploaded_file,
:description => "",
@@ -479,7 +480,7 @@ def self.write_content_to_path(project, path, content)
#a.save
raise InsufficientStorageError
end
- uploaded_file.close!
+ tmpfile.close!
Mailer.deliver_attachments_added([ a ])
end
end

0 comments on commit 7728bfe

Please sign in to comment.