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); } }