summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-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