In localfs.js#L343 there is an issue where the callback is called with an error but no meta object.
In the callback error case meta.stream is accessed. Since meta is undefined, this throws, making the entire point of a callback for the error case meaningless. (and as it so happens, this crashes my c9 install)
var callback = function (err, meta) {
if (called) {
if (err) {
if (meta.stream) meta.stream.emit("error", err);
else console.error(err.stack);
}
else if (meta.stream) meta.stream.emit("saved");
return;
}
called = true;
return realCallback.apply(this, arguments);
};
if (options.stream && !options.stream.readable) {
return callback(new TypeError("options.stream must be readable."));
}
Changing that like the following should fix this.
var callback = function (err, meta) {
if (called) {
if (err) {
if (meta && meta.stream) meta.stream.emit("error", err);
else console.error(err.stack);
}
else if (meta && meta.stream) meta.stream.emit("saved");
return;
}
called = true;
return realCallback.apply(this, arguments);
};
if (options.stream && !options.stream.readable) {
return callback(new TypeError("options.stream must be readable."));
}
In localfs.js#L343 there is an issue where the callback is called with an error but no meta object.
In the callback error case meta.stream is accessed. Since meta is undefined, this throws, making the entire point of a callback for the error case meaningless. (and as it so happens, this crashes my c9 install)
Changing that like the following should fix this.