Commit b92daed5 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Sebastien Robin

Fix some errors and bugs

parent f35ad6e7
...@@ -373,16 +373,20 @@ ...@@ -373,16 +373,20 @@
lastModified: Date.now() lastModified: Date.now()
} }
this.save(); this.save();
if(option.success) option.success(); if(option.success !== undefined) option.success();
} else { } else {
if(option.overwrite) { //overwrite if(option.overwrite === undefined ||
option.overwrite) { // overwrite (true or undefined)
this.documents[fileName].lastModified = Date.now(); this.documents[fileName].lastModified = Date.now();
this.documents[fileName].content = data; this.documents[fileName].content = data;
this.save(); this.save();
if(option.success !== undefined) option.success(); if(option.success !== undefined) option.success();
} else { //repport an error } else { // repport an error
var error = {status: 403,message: "document already exists"}; if(option.errorHandler !== undefined) {
if(option.errorHandler) option.errorHandler(error); option.errorHandler(
{status: 403, message: "document already exists"}
);
}
} }
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment