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); return callback(err);
} }
// Save the details of the new revision of the tiddler // Save the details of the new revision of the tiddler
var etagInfo = self.parseEtag(request.getResponseHeader("Etag")); var etag = request.getResponseHeader("Etag");
// Invoke the callback if(!etag) {
callback(null,{ callback("Response from server is missing required `etag` header");
bag: etagInfo.bag } else {
}, etagInfo.revision); var etagInfo = self.parseEtag(etag);
// Invoke the callback
callback(null,{
bag: etagInfo.bag
}, etagInfo.revision);
}
} }
}); });
}; };