Commit d1129ade authored by Stan Hu's avatar Stan Hu

Merge branch '32595-blame-or-history-newline-in-filename' into 'master'

Fix for #32595, users can view the blame or history of file with newlines in its filename.

Closes #32595

See merge request gitlab-org/gitlab!17543
parents 30bbab28 0fd9ceb5
---
title: Users can view the blame or history of a file with newlines in its filename.
merge_request: 17543
author: Jesse Hall @jessehall3
type: fixed
......@@ -34,7 +34,7 @@ scope format: false do
# ref regex used in constraints. Regex verification now done in controller.
get 'logs_tree/*path', action: :logs_tree, as: :logs_file, format: false, constraints: {
id: /.*/,
path: /.*/
path: /[^\0]*/
}
end
end
......
......@@ -276,6 +276,11 @@ describe 'project routing' do
expect(get('/gitlab/gitlabhq/refs/feature%2B45/logs_tree/foo/bar/baz')).to route_to('projects/refs#logs_tree', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature+45', path: 'foo/bar/baz')
expect(get('/gitlab/gitlabhq/refs/feature@45/logs_tree/foo/bar/baz')).to route_to('projects/refs#logs_tree', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45', path: 'foo/bar/baz')
expect(get('/gitlab/gitlabhq/refs/stable/logs_tree/files.scss')).to route_to('projects/refs#logs_tree', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'stable', path: 'files.scss')
assert_routing({ path: "/gitlab/gitlabhq/refs/stable/logs_tree/new%0A%0Aline.txt",
method: :get },
{ controller: 'projects/refs', action: 'logs_tree',
namespace_id: 'gitlab', project_id: 'gitlabhq',
id: "stable", path: "new\n\nline.txt" })
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment