made changes as per thomas's and dave's PR review

This commit is contained in:
Stephen Ward 2018-10-09 20:25:19 -04:00
parent 62b85d1442
commit 7a6a4160e6
2 changed files with 6 additions and 5 deletions

View File

@ -534,8 +534,9 @@ function remove_directory(context, path, callback) {
}
function open_file(context, path, flags, mode, callback) {
if (typeof mode == 'function'){
if (typeof mode === 'function'){
callback = mode;
mode = null
}
path = normalize(path);
var name = basename(path);
@ -648,7 +649,9 @@ function open_file(context, path, flags, mode, callback) {
}
fileNode = result;
fileNode.nlinks += 1;
if(mode){Node.setMode(mode, fileNode);}
if(mode){
Node.setMode(mode, fileNode);
}
context.putObject(fileNode.id, fileNode, write_file_data);
});
}
@ -1627,12 +1630,11 @@ function open(fs, context, path, flags, mode, callback) {
* callback = makeCallback(callback);
* }
*/
if (arguments.length == 5){
if (arguments.length < 6 ){
callback = arguments[arguments.length - 1];
mode = 0o644;
}
else {
//need to test this validateAndMakeMode
mode = validateAndMaskMode(mode, FULL_READ_WRITE_EXEC_PERMISSIONS, callback);
}

View File

@ -123,7 +123,6 @@ describe('fs.open', function() {
});
});
/**
* This test is currently correct per our code, but incorrect according to the spec.
* When we fix https://github.com/filerjs/filer/issues/314 we'll have to update this.