diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2019-04-30 19:35:12 +0300 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2019-04-30 21:09:40 +0300 |
commit | ee32e06f1f117e748963a8badf6abfd5b57f339b (patch) | |
tree | c4ed8ebc710127d6932cd9c7ad91fc92ec726e72 /app/assets/javascripts/ide | |
parent | 2432a540cff461c5d9c0346dd4021229078d674d (diff) |
Fix IDE get file data with '/' as relative root
https://gitlab.com/gitlab-org/gitlab-ce/issues/60932
Diffstat (limited to 'app/assets/javascripts/ide')
-rw-r--r-- | app/assets/javascripts/ide/stores/actions/file.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/assets/javascripts/ide/stores/actions/file.js b/app/assets/javascripts/ide/stores/actions/file.js index e74b880e02c..e7e8ac6d80b 100644 --- a/app/assets/javascripts/ide/stores/actions/file.js +++ b/app/assets/javascripts/ide/stores/actions/file.js @@ -1,5 +1,6 @@ -import { __ } from '../../../locale'; -import { normalizeHeaders } from '../../../lib/utils/common_utils'; +import { joinPaths } from '~/lib/utils/url_utility'; +import { normalizeHeaders } from '~/lib/utils/common_utils'; +import { __ } from '~/locale'; import eventHub from '../../eventhub'; import service from '../../services'; import * as types from '../mutation_types'; @@ -69,7 +70,7 @@ export const getFileData = ( const url = file.prevPath ? file.url.replace(file.path, file.prevPath) : file.url; return service - .getFileData(`${gon.relative_url_root ? gon.relative_url_root : ''}${url.replace('/-/', '/')}`) + .getFileData(joinPaths(gon.relative_url_root || '', url.replace('/-/', '/'))) .then(({ data, headers }) => { const normalizedHeaders = normalizeHeaders(headers); setPageTitle(decodeURI(normalizedHeaders['PAGE-TITLE'])); |