diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-05-26 16:57:25 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-05-26 16:57:25 +0000 |
commit | c99da154452d97e9ffed933e9645db60f66cdf52 (patch) | |
tree | c625f4ce041fea82128dcafa8effa16dcdf53a52 /app/controllers/attachments_controller.rb | |
parent | ef39db234b40e557e8e229c5c8ca5792724c6423 (diff) | |
download | redmine-c99da154452d97e9ffed933e9645db60f66cdf52.tar.gz redmine-c99da154452d97e9ffed933e9645db60f66cdf52.zip |
Show a 404 error page if attachment can not be read.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@544 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/attachments_controller.rb')
-rw-r--r-- | app/controllers/attachments_controller.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 3528e7220..e0a02d8e8 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -16,17 +16,22 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class AttachmentsController < ApplicationController + layout 'base' before_filter :find_project, :check_project_privacy # sends an attachment def download send_file @attachment.diskfile, :filename => @attachment.filename + rescue + render_404 end # 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' + rescue + render_404 end private |