OSDN Git Service

Added filename header when sending an image inline
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 27 May 2007 18:45:48 +0000 (18:45 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 27 May 2007 18:45:48 +0000 (18:45 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@550 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/attachments_controller.rb

index e0a02d8..3ddb052 100644 (file)
@@ -29,7 +29,7 @@ class AttachmentsController < ApplicationController
   # sends an image to be displayed inline
   def show
     render(:nothing => true, :status => 404) and return unless @attachment.diskfile =~ /\.(jpeg|jpg|gif|png)$/i
-    send_file @attachment.diskfile, :type => "image/#{$1}", :disposition => 'inline'
+    send_file @attachment.diskfile, :filename => @attachment.filename, :type => "image/#{$1}", :disposition => 'inline'
   rescue
     render_404
   end