Fix options.tiddlerinfo is undefined on New TIddler button click

See https://talk.tiddlywiki.org/t/nodejs-wiki-typeerror-options-tiddlerinfo-is-undefined-on-new-tiddler-button-click/5583
This commit is contained in:
jeremy@jermolene.com 2022-12-30 19:38:42 +00:00
parent 9f69161709
commit 153cef5697
1 changed files with 3 additions and 3 deletions

View File

@ -198,7 +198,7 @@ Save a tiddler and invoke the callback with (err,adaptorInfo,revision)
TiddlyWebAdaptor.prototype.saveTiddler = function(tiddler,callback,options) { TiddlyWebAdaptor.prototype.saveTiddler = function(tiddler,callback,options) {
var self = this; var self = this;
if(this.isReadOnly) { if(this.isReadOnly) {
return callback(null,options.tiddlerInfo.adaptorInfo); return callback(null);
} }
$tw.utils.httpRequest({ $tw.utils.httpRequest({
url: this.host + "recipes/" + encodeURIComponent(this.recipe) + "/tiddlers/" + encodeURIComponent(tiddler.fields.title), url: this.host + "recipes/" + encodeURIComponent(this.recipe) + "/tiddlers/" + encodeURIComponent(tiddler.fields.title),
@ -220,7 +220,7 @@ TiddlyWebAdaptor.prototype.saveTiddler = function(tiddler,callback,options) {
// Invoke the callback // Invoke the callback
callback(null,{ callback(null,{
bag: etagInfo.bag bag: etagInfo.bag
},etagInfo.revision); },etagInfo.revision);
} }
} }
}); });
@ -251,7 +251,7 @@ tiddlerInfo: the syncer's tiddlerInfo for this tiddler
TiddlyWebAdaptor.prototype.deleteTiddler = function(title,callback,options) { TiddlyWebAdaptor.prototype.deleteTiddler = function(title,callback,options) {
var self = this; var self = this;
if(this.isReadOnly) { if(this.isReadOnly) {
return callback(null,options.tiddlerInfo.adaptorInfo); return callback(null);
} }
// 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 // 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; var bag = options.tiddlerInfo.adaptorInfo && options.tiddlerInfo.adaptorInfo.bag;