From e0bdabbcea48240373f3ab3b734d40da61a26157 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: Thu, 23 Jun 2022 19:28:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20CLI:=20Add=20windows=20support?= =?UTF-8?q?=20to=20import:credentials=20--separate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 8405379c49169..fe5bf7adbd519 100644 --- a/packages/cli/commands/import/credentials.ts +++ b/packages/cli/commands/import/credentials.ts @@ -13,7 +13,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'; @@ -87,9 +86,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;