From 2fb590e8440ac35567fdbf745b294d79feb8c5a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Wed, 27 Jul 2022 15:57:44 +0200 Subject: [PATCH] fix(core): Add windows support to import:credentials --separate (#3589) --- packages/cli/commands/import/credentials.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/cli/commands/import/credentials.ts b/packages/cli/commands/import/credentials.ts index e405d1d5c..da6453a65 100644 --- a/packages/cli/commands/import/credentials.ts +++ b/packages/cli/commands/import/credentials.ts @@ -14,7 +14,6 @@ import { LoggerProxy } from 'n8n-workflow'; import fs from 'fs'; import glob from 'fast-glob'; -import path from 'path'; import { EntityManager, getConnection } from 'typeorm'; import { getLogger } from '../../src/Logger'; import { Db } from '../../src'; @@ -88,9 +87,15 @@ export class ImportCredentialsCommand extends Command { const encryptionKey = await UserSettings.getEncryptionKey(); if (flags.separate) { - const files = await glob( - `${flags.input.endsWith(path.sep) ? flags.input : flags.input + path.sep}*.json`, - ); + let { input: inputPath } = flags; + + if (process.platform === 'win32') { + inputPath = inputPath.replace(/\\/g, '/'); + } + + inputPath = inputPath.replace(/\/$/g, ''); + + const files = await glob(`${inputPath}/*.json`); totalImported = files.length;