From 7a6a4160e6ed144a1327626e50b760c3c6bcc2d0 Mon Sep 17 00:00:00 2001 From: Stephen Ward Date: Tue, 9 Oct 2018 20:25:19 -0400 Subject: [PATCH] made changes as per thomas's and dave's PR review --- src/filesystem/implementation.js | 10 ++++++---- tests/spec/fs.open.spec.js | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/filesystem/implementation.js b/src/filesystem/implementation.js index 9548971..4b44f18 100644 --- a/src/filesystem/implementation.js +++ b/src/filesystem/implementation.js @@ -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); } diff --git a/tests/spec/fs.open.spec.js b/tests/spec/fs.open.spec.js index 474fd23..ba76408 100644 --- a/tests/spec/fs.open.spec.js +++ b/tests/spec/fs.open.spec.js @@ -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.