mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
AWS Plugin: Fix crash when attempting to save a missing tiddler
This commit is contained in:
parent
24c325611b
commit
7a714da9cb
@ -132,7 +132,7 @@ Command.prototype.subCommands["s3-rendertiddlers"] = function() {
|
|||||||
saveTypeFilter = this.params[7] || "[[" + type + "]]",
|
saveTypeFilter = this.params[7] || "[[" + type + "]]",
|
||||||
tiddlers = wiki.filterTiddlers(filter);
|
tiddlers = wiki.filterTiddlers(filter);
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if(!filter || !template || !region || !bucket || !filenameFilter) {
|
if(!filter || !region || !bucket || !filenameFilter) {
|
||||||
throw "Missing parameters";
|
throw "Missing parameters";
|
||||||
}
|
}
|
||||||
async.eachLimit(
|
async.eachLimit(
|
||||||
@ -210,12 +210,16 @@ Command.prototype.subCommands["s3-savetiddlers"] = function() {
|
|||||||
tiddlers,
|
tiddlers,
|
||||||
20,
|
20,
|
||||||
function(title,callback) {
|
function(title,callback) {
|
||||||
var tiddler = wiki.getTiddler(title),
|
var tiddler = wiki.getTiddler(title);
|
||||||
text = tiddler.fields.text || "",
|
if(tiddler) {
|
||||||
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
var text = tiddler.fields.text || "",
|
||||||
filename = wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0],
|
type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||||
saveType = wiki.filterTiddlers(saveTypeFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0];
|
filename = wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0],
|
||||||
awsUtils.putFile(region,bucket,filename,text,saveType || type,callback);
|
saveType = wiki.filterTiddlers(saveTypeFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0];
|
||||||
|
awsUtils.putFile(region,bucket,filename,text,saveType || type,callback);
|
||||||
|
} else {
|
||||||
|
process.nextTick(callback,null);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
function(err,results) {
|
function(err,results) {
|
||||||
self.callback(err,results);
|
self.callback(err,results);
|
||||||
|
Loading…
Reference in New Issue
Block a user