From 8840a11a9996225612ad55659a238fcd98780465 Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 17 Jun 2014 18:38:13 +0800 Subject: [PATCH] attachments error --- app/controllers/attachments_controller.rb | 2 ++ public/file_not_found.html | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 public/file_not_found.html diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 99160b0c0..65206350e 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -59,6 +59,8 @@ class AttachmentsController < ApplicationController :type => detect_content_type(@attachment), :disposition => (@attachment.image? ? 'inline' : 'attachment') end + rescue => e + redirect_to "http://forge.trustie.net/file_not_found.html" end #更新资源文件类型 diff --git a/public/file_not_found.html b/public/file_not_found.html new file mode 100644 index 000000000..80b0e3dde --- /dev/null +++ b/public/file_not_found.html @@ -0,0 +1,23 @@ + + +文件未找到 + + +

文件已经损坏

+

抱歉,因文件已经损坏,请重新上传此文件.

+

Back

+ +