summaryrefslogtreecommitdiffstats
path: root/app/models/attachment.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-09-11 19:19:24 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-09-11 19:19:24 +0000
commit02fca76c13cde18859eaf6dde2381328feaacb39 (patch)
treebf3e7c6231756b40a7abac6db438bbfaf43484d1 /app/models/attachment.rb
parent06efcaddfa6a62022c868e1faee1b25df8935e93 (diff)
downloadredmine-02fca76c13cde18859eaf6dde2381328feaacb39.tar.gz
redmine-02fca76c13cde18859eaf6dde2381328feaacb39.zip
Strip eols from file names (#14819).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12128 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/attachment.rb')
-rw-r--r--app/models/attachment.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index eeab56242..dd1aa3a7c 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -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