From 11506e9acf9fccee96f569dd7c6cc13890f29a80 Mon Sep 17 00:00:00 2001 From: Jan-Oliver Kaiser Date: Wed, 11 Sep 2019 11:21:31 +0200 Subject: [PATCH] Fix gitlab saver (#4243) This fixes the HTTP request sent to gitlab that is meant to see if the target file already exists. It did not follow the official gitlab v4 api documentation. That documentation dictates both `path` and `branch` to be passed via corresponding GET parameters. --- core/modules/savers/gitlab.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/modules/savers/gitlab.js b/core/modules/savers/gitlab.js index 505face43..cce69099c 100644 --- a/core/modules/savers/gitlab.js +++ b/core/modules/savers/gitlab.js @@ -48,12 +48,9 @@ GitLabSaver.prototype.save = function(text,method,callback) { var uri = endpoint + "/projects/" + encodeURIComponent(repo) + "/repository/"; // Perform a get request to get the details (inc shas) of files in the same path as our file $tw.utils.httpRequest({ - url: uri + "tree/" + encodeURIComponent(path.replace(/^\/+|\/$/g, '')), + url: uri + "tree/?path=" + encodeURIComponent(path.replace(/^\/+|\/$/g, '')) + "&branch=" + encodeURIComponent(branch.replace(/^\/+|\/$/g, '')), type: "GET", headers: headers, - data: { - ref: branch - }, callback: function(err,getResponseDataJson,xhr) { var getResponseData,sha = ""; if(err && xhr.status !== 404) {