Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-17 00:06:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-17 00:06:10 +0300
commit00bfd2d81d2539e16829585f203169bdd0274bec (patch)
tree5d201485a5cda4505131396ac0c8155ae812ba8f /app/assets/javascripts/ide/services
parent409c3cb076e500968ec4c283cb388b56f3e7c9e6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/ide/services')
-rw-r--r--app/assets/javascripts/ide/services/index.js31
1 files changed, 20 insertions, 11 deletions
diff --git a/app/assets/javascripts/ide/services/index.js b/app/assets/javascripts/ide/services/index.js
index ba33b6826d6..f6ad2f9c7d1 100644
--- a/app/assets/javascripts/ide/services/index.js
+++ b/app/assets/javascripts/ide/services/index.js
@@ -1,4 +1,6 @@
import axios from '~/lib/utils/axios_utils';
+import { joinPaths } from '~/lib/utils/url_utility';
+import { escapeFileUrl } from '../stores/utils';
import Api from '~/api';
export default {
@@ -23,18 +25,25 @@ export default {
.then(({ data }) => data);
},
getBaseRawFileData(file, sha) {
- if (file.tempFile) {
- return Promise.resolve(file.baseRaw);
- }
+ if (file.tempFile || file.baseRaw) return Promise.resolve(file.baseRaw);
- if (file.baseRaw) {
- return Promise.resolve(file.baseRaw);
- }
+ // if files are renamed, their base path has changed
+ const filePath =
+ file.mrChange && file.mrChange.renamed_file ? file.mrChange.old_path : file.path;
return axios
- .get(file.rawPath.replace(`/raw/${file.branchId}/${file.path}`, `/raw/${sha}/${file.path}`), {
- transformResponse: [f => f],
- })
+ .get(
+ joinPaths(
+ gon.relative_url_root || '/',
+ file.projectId,
+ 'raw',
+ sha,
+ escapeFileUrl(filePath),
+ ),
+ {
+ transformResponse: [f => f],
+ },
+ )
.then(({ data }) => data);
},
getProjectData(namespace, project) {
@@ -58,8 +67,8 @@ export default {
commit(projectId, payload) {
return Api.commitMultiple(projectId, payload);
},
- getFiles(projectUrl, branchId) {
- const url = `${projectUrl}/files/${branchId}`;
+ getFiles(projectUrl, ref) {
+ const url = `${projectUrl}/files/${ref}`;
return axios.get(url, { params: { format: 'json' } });
},
lastCommitPipelines({ getters }) {