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:
Diffstat (limited to 'app/assets/javascripts/ide/stores/utils.js')
-rw-r--r--app/assets/javascripts/ide/stores/utils.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/app/assets/javascripts/ide/stores/utils.js b/app/assets/javascripts/ide/stores/utils.js
index d9cdc7727ad..b7ced3a271a 100644
--- a/app/assets/javascripts/ide/stores/utils.js
+++ b/app/assets/javascripts/ide/stores/utils.js
@@ -3,7 +3,7 @@ import {
relativePathToAbsolute,
isAbsolute,
isRootRelative,
- isBase64DataUrl,
+ isBlobUrl,
} from '~/lib/utils/url_utility';
export const dataStructure = () => ({
@@ -110,14 +110,19 @@ export const createCommitPayload = ({
}) => ({
branch,
commit_message: state.commitMessage || getters.preBuiltCommitMessage,
- actions: getCommitFiles(rootState.stagedFiles).map(f => ({
- action: commitActionForFile(f),
- file_path: f.path,
- previous_path: f.prevPath || undefined,
- content: f.prevPath && !f.changed ? null : f.content || undefined,
- encoding: isBase64DataUrl(f.rawPath) ? 'base64' : 'text',
- last_commit_id: newBranch || f.deleted || f.prevPath ? undefined : f.lastCommitSha,
- })),
+ actions: getCommitFiles(rootState.stagedFiles).map(f => {
+ const isBlob = isBlobUrl(f.rawPath);
+ const content = isBlob ? btoa(f.content) : f.content;
+
+ return {
+ action: commitActionForFile(f),
+ file_path: f.path,
+ previous_path: f.prevPath || undefined,
+ content: f.prevPath && !f.changed ? null : content || undefined,
+ encoding: isBlob ? 'base64' : 'text',
+ last_commit_id: newBranch || f.deleted || f.prevPath ? undefined : f.lastCommitSha,
+ };
+ }),
start_sha: newBranch ? rootGetters.lastCommit.id : undefined,
});