1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

TiddlyWebAdaptor: Don't crash if "etag" header is missing

This commit is contained in:
jeremy@jermolene.com 2021-01-03 11:46:40 +00:00
parent fecf622616
commit e96a54c753

View File

@ -197,11 +197,16 @@ TiddlyWebAdaptor.prototype.saveTiddler = function(tiddler,callback) {
return callback(err);
}
// Save the details of the new revision of the tiddler
var etagInfo = self.parseEtag(request.getResponseHeader("Etag"));
// Invoke the callback
callback(null,{
bag: etagInfo.bag
}, etagInfo.revision);
var etag = request.getResponseHeader("Etag");
if(!etag) {
callback("Response from server is missing required `etag` header");
} else {
var etagInfo = self.parseEtag(etag);
// Invoke the callback
callback(null,{
bag: etagInfo.bag
}, etagInfo.revision);
}
}
});
};