1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

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.
This commit is contained in:
Jan-Oliver Kaiser 2019-09-11 11:21:31 +02:00 committed by Jeremy Ruston
parent 1631f21a6b
commit 11506e9acf

View File

@ -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) {