From 903b467bb861d5e2d3a6ece18e346a2b18cea851 Mon Sep 17 00:00:00 2001 From: Seth Falco Date: Mon, 5 Feb 2024 23:12:52 +0000 Subject: [PATCH] fix: output to new directory if trailing slash --- lib/svgo/coa.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/svgo/coa.js b/lib/svgo/coa.js index 4b434fe5c..62404fc34 100644 --- a/lib/svgo/coa.js +++ b/lib/svgo/coa.js @@ -15,13 +15,13 @@ const regSVGFile = /\.svg$/i; /** * Synchronously check if path is a directory. Tolerant to errors like ENOENT. * - * @param {string} path + * @param {string} filePath */ -export function checkIsDir(path) { +export function checkIsDir(filePath) { try { - return fs.lstatSync(path).isDirectory(); + return fs.lstatSync(filePath).isDirectory(); } catch (e) { - return false; + return filePath.endsWith(path.sep); } }