Commit 179e4512 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'ph/encodeUriComponentNewDirectoryPath' into 'master'

Fix new file not being created in non-ascii character folders

See merge request gitlab-org/gitlab!26165
parents 542f6552 68aacde6
......@@ -134,7 +134,9 @@ export default {
},
{
attrs: {
href: `${this.newBlobPath}/${this.currentPath ? escape(this.currentPath) : ''}`,
href: `${this.newBlobPath}/${
this.currentPath ? encodeURIComponent(this.currentPath) : ''
}`,
class: 'qa-new-file-option',
},
text: __('New file'),
......
......@@ -25,10 +25,10 @@ export default {
const splitArray = this.path.split('/');
splitArray.pop();
return splitArray.join('/');
return splitArray.map(p => encodeURIComponent(p)).join('/');
},
parentRoute() {
return { path: `/-/tree/${escape(this.commitRef)}/${escape(this.parentPath)}` };
return { path: `/-/tree/${escape(this.commitRef)}/${this.parentPath}` };
},
},
methods: {
......
---
title: Fix new file not being created in non-ascii character folders
merge_request: 26165
author:
type: fixed
......@@ -35,6 +35,7 @@ describe('Repository parent row component', () => {
${'app'} | ${'/-/tree/master/'}
${'app/assets'} | ${'/-/tree/master/app'}
${'app/assets#/test'} | ${'/-/tree/master/app/assets%23'}
${'app/assets#/test/world'} | ${'/-/tree/master/app/assets%23/test'}
`('renders link in $path to $to', ({ path, to }) => {
factory(path);
......
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