Skip to content
Snippets Groups Projects
Unverified Commit 118bd717 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Sanitize snippet file name in raw headers

parent f28a12a5
No related branches found
No related tags found
1 merge request!8686add "Uplaod" and "Replace" functionality
Loading
Loading
@@ -68,7 +68,7 @@ class Projects::SnippetsController < Projects::ApplicationController
@snippet.content,
type: 'text/plain; charset=utf-8',
disposition: 'inline',
filename: @snippet.file_name
filename: @snippet.sanitized_file_name
)
end
 
Loading
Loading
Loading
Loading
@@ -79,7 +79,7 @@ class SnippetsController < ApplicationController
@snippet.content,
type: 'text/plain; charset=utf-8',
disposition: 'inline',
filename: @snippet.file_name
filename: @snippet.sanitized_file_name
)
end
 
Loading
Loading
Loading
Loading
@@ -64,6 +64,10 @@ class Snippet < ActiveRecord::Base
file_name
end
 
def sanitized_file_name
file_name.gsub(/[^a-zA-Z0-9_\-\.]+/, '')
end
def mode
nil
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment