From cd7b1b484f550b142cf52cc56c4b81e98bc07e2f Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Thu, 17 Dec 2020 17:04:58 +0000 Subject: [PATCH] Allow the setting of an absolute path for IO --- src/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index defff75..4edabe5 100644 --- a/src/index.js +++ b/src/index.js @@ -22,6 +22,8 @@ const checkDataTypeCompatibility = (params) => { return allowedParamsDataTypes.includes(typeof params) } +const checkIfAbsolutePath = path => path.startsWith('/') || path.startsWith('~/'); + module.exports = function openssl(params, callback = () => undefined) { const stdout = []; @@ -66,7 +68,7 @@ module.exports = function openssl(params, callback = () => undefined) { parameters[i] = dir + parameters[i]; } - if (checkCommandForIO(parameters[i]) && typeof parameters[i + 1] !== 'object') { + if (checkCommandForIO(parameters[i]) && typeof parameters[i + 1] !== 'object' && !checkIfAbsolutePath(parameters[i +1])) { parameters[i + 1] = dir + parameters[i + 1]; } }