Strip eols from file names (#14819).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12128 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -294,10 +294,10 @@ class Attachment < ActiveRecord::Base
|
||||
|
||||
def sanitize_filename(value)
|
||||
# get only the filename, not the whole path
|
||||
just_filename = value.gsub(/^.*(\\|\/)/, '')
|
||||
just_filename = value.gsub(/\A.*(\\|\/)/m, '')
|
||||
|
||||
# Finally, replace invalid characters with underscore
|
||||
@filename = just_filename.gsub(/[\/\?\%\*\:\|\"\'<>]+/, '_')
|
||||
@filename = just_filename.gsub(/[\/\?\%\*\:\|\"\'<>\n\r]+/, '_')
|
||||
end
|
||||
|
||||
# Returns the subdirectory in which the attachment will be saved
|
||||
|
||||
Reference in New Issue
Block a user