From f2ed27e5c79748b923c3202ac26d8d17576186b8 Mon Sep 17 00:00:00 2001 From: Juri Leino Date: Wed, 26 Oct 2022 09:27:13 +0200 Subject: [PATCH] fix: parseLocal without options `parseLocal` will use defaults for `mimetype` and `replace` when called without options. --- components/documents.js | 4 ++-- spec/tests/resources.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/documents.js b/components/documents.js index e0ddb49..7c7f27f 100644 --- a/components/documents.js +++ b/components/documents.js @@ -6,8 +6,8 @@ function upload (client, contentBuffer) { function parseLocal (client, handle, filename, options) { // set default values - const mimeType = getMimeType(filename, options.mimetype) - const replace = options.replace || true + const mimeType = getMimeType(filename, options && options.mimetype ? options.mimetype : null) + const replace = options && options.replace ? options.replace : true return client.promisedMethodCall('parseLocal', [handle, filename, replace, mimeType]) } diff --git a/spec/tests/resources.js b/spec/tests/resources.js index ca1f250..722e415 100644 --- a/spec/tests/resources.js +++ b/spec/tests/resources.js @@ -77,7 +77,7 @@ test('resources:', function (t) { return db.documents.upload(Buffer.from('1')) }) .then(function (fh) { - return db.documents.parseLocal(fh, testCollection + '/test.xql', {}) + return db.documents.parseLocal(fh, testCollection + '/test.xql') }) .then(function (r) { setup.ok(r, 'setup ended')