Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
118bd717
Commit
118bd717
authored
Dec 12, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sanitize snippet file name in raw headers
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
f28a12a5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
2 deletions
+6
-2
app/controllers/projects/snippets_controller.rb
app/controllers/projects/snippets_controller.rb
+1
-1
app/controllers/snippets_controller.rb
app/controllers/snippets_controller.rb
+1
-1
app/models/snippet.rb
app/models/snippet.rb
+4
-0
No files found.
app/controllers/projects/snippets_controller.rb
View file @
118bd717
...
...
@@ -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
...
...
app/controllers/snippets_controller.rb
View file @
118bd717
...
...
@@ -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
...
...
app/models/snippet.rb
View file @
118bd717
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment