Returns a 404 error when trying to view/download an attachment that can't be read from disk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2692 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-04-25 09:31:36 +00:00
parent 914ef1cb25
commit 15a14e55cd
3 changed files with 18 additions and 3 deletions
+5
View File
@@ -126,6 +126,11 @@ class Attachment < ActiveRecord::Base
self.filename =~ /\.(patch|diff)$/i
end
# Returns true if the file is readable
def readable?
File.readable?(diskfile)
end
private
def sanitize_filename(value)
# get only the filename, not the whole path