1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

GitHub saver: Fix problem with saving to a non-existent directory

This commit is contained in:
Jermolene 2019-04-15 21:08:04 +01:00
parent 232eba2f7d
commit b32a5aa9af

View File

@ -56,16 +56,18 @@ GitHubSaver.prototype.save = function(text,method,callback) {
ref: branch ref: branch
}, },
callback: function(err,getResponseDataJson,xhr) { callback: function(err,getResponseDataJson,xhr) {
if(err) { var getResponseData,sha = "";
if(err && xhr.status !== 404) {
return callback(err); return callback(err);
} }
var getResponseData = JSON.parse(getResponseDataJson), if(xhr.status !== 404) {
sha = ""; getResponseData = JSON.parse(getResponseDataJson);
$tw.utils.each(getResponseData,function(details) { $tw.utils.each(getResponseData,function(details) {
if(details.name === filename) { if(details.name === filename) {
sha = details.sha; sha = details.sha;
} }
}); });
}
var data = { var data = {
message: "Saved by TiddlyWiki", message: "Saved by TiddlyWiki",
content: base64utf8.base64.encode.call(base64utf8,text), content: base64utf8.base64.encode.call(base64utf8,text),