Fix filesystem (#5465)

This commit is contained in:
Joshua Fontany
2021-02-04 08:11:07 -08:00
committed by GitHub
parent 9f9ce6595b
commit bfa062f23d
6 changed files with 96 additions and 57 deletions

View File

@@ -182,10 +182,10 @@ TiddlyWebAdaptor.prototype.getSkinnyTiddlers = function(callback) {
/*
Save a tiddler and invoke the callback with (err,adaptorInfo,revision)
*/
TiddlyWebAdaptor.prototype.saveTiddler = function(tiddler,callback) {
TiddlyWebAdaptor.prototype.saveTiddler = function(tiddler,callback,options) {
var self = this;
if(this.isReadOnly) {
return callback(null);
return callback(null,options.tiddlerInfo.adaptorInfo);
}
$tw.utils.httpRequest({
url: this.host + "recipes/" + encodeURIComponent(this.recipe) + "/tiddlers/" + encodeURIComponent(tiddler.fields.title),
@@ -207,7 +207,7 @@ TiddlyWebAdaptor.prototype.saveTiddler = function(tiddler,callback) {
// Invoke the callback
callback(null,{
bag: etagInfo.bag
}, etagInfo.revision);
},etagInfo.revision);
}
}
});
@@ -238,12 +238,12 @@ tiddlerInfo: the syncer's tiddlerInfo for this tiddler
TiddlyWebAdaptor.prototype.deleteTiddler = function(title,callback,options) {
var self = this;
if(this.isReadOnly) {
return callback(null);
return callback(null,options.tiddlerInfo.adaptorInfo);
}
// If we don't have a bag it means that the tiddler hasn't been seen by the server, so we don't need to delete it
var bag = options.tiddlerInfo.adaptorInfo && options.tiddlerInfo.adaptorInfo.bag;
if(!bag) {
return callback(null);
return callback(null,options.tiddlerInfo.adaptorInfo);
}
// Issue HTTP request to delete the tiddler
$tw.utils.httpRequest({
@@ -253,8 +253,8 @@ TiddlyWebAdaptor.prototype.deleteTiddler = function(title,callback,options) {
if(err) {
return callback(err);
}
// Invoke the callback
callback(null);
// Invoke the callback & return null adaptorInfo
callback(null,null);
}
});
};