diff options
author | Kieran Andrews <hiddentiger@gmail.com> | 2019-04-03 14:38:46 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-04-03 14:38:46 +0300 |
commit | ebbcc17f243337581536bd1f34dc7d6b5712ebb9 (patch) | |
tree | 40be20a716ff5501982489a6dd48a7de0c0a42a3 /app/assets/javascripts/ide/lib | |
parent | 7700e0298802857495bd3d0e7601a5d47a7b3335 (diff) |
Merge branch 'feature/webide_escaping' of gitlab.com:hiddentiger/gitlab-ce into feature/webide_escaping
Diffstat (limited to 'app/assets/javascripts/ide/lib')
-rw-r--r-- | app/assets/javascripts/ide/lib/files.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/assets/javascripts/ide/lib/files.js b/app/assets/javascripts/ide/lib/files.js index 5dfba8fe531..df100f753d7 100644 --- a/app/assets/javascripts/ide/lib/files.js +++ b/app/assets/javascripts/ide/lib/files.js @@ -1,6 +1,8 @@ import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils'; import { decorateData, sortTree } from '../stores/utils'; +export const escapeFileUrl = fileUrl => encodeURIComponent(fileUrl).replace(/%2F/g, '/'); + export const splitParent = path => { const idx = path.lastIndexOf('/'); @@ -45,7 +47,7 @@ export const decorateFiles = ({ id: path, name, path, - url: `/${projectId}/tree/${branchId}/-/${path}/`, + url: `/${projectId}/tree/${branchId}/-/${escapeFileUrl(path)}/`, type: 'tree', parentTreeUrl: parentFolder ? parentFolder.url : `/${projectId}/tree/${branchId}/`, tempFile, @@ -81,7 +83,7 @@ export const decorateFiles = ({ id: path, name, path, - url: `/${projectId}/blob/${branchId}/-/${path}`, + url: `/${projectId}/blob/${branchId}/-/${escapeFileUrl(path)}`, type: 'blob', parentTreeUrl: fileFolder ? fileFolder.url : `/${projectId}/blob/${branchId}`, tempFile, |