fix(core): Add windows support to import:credentials --separate (#3589)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2022-07-27 15:57:44 +02:00
committed by GitHub
parent 92b2caaf26
commit 2fb590e844

View File

@@ -14,7 +14,6 @@ import { LoggerProxy } from 'n8n-workflow';
import fs from 'fs'; import fs from 'fs';
import glob from 'fast-glob'; import glob from 'fast-glob';
import path from 'path';
import { EntityManager, getConnection } from 'typeorm'; import { EntityManager, getConnection } from 'typeorm';
import { getLogger } from '../../src/Logger'; import { getLogger } from '../../src/Logger';
import { Db } from '../../src'; import { Db } from '../../src';
@@ -88,9 +87,15 @@ export class ImportCredentialsCommand extends Command {
const encryptionKey = await UserSettings.getEncryptionKey(); const encryptionKey = await UserSettings.getEncryptionKey();
if (flags.separate) { if (flags.separate) {
const files = await glob( let { input: inputPath } = flags;
`${flags.input.endsWith(path.sep) ? flags.input : flags.input + path.sep}*.json`,
); if (process.platform === 'win32') {
inputPath = inputPath.replace(/\\/g, '/');
}
inputPath = inputPath.replace(/\/$/g, '');
const files = await glob(`${inputPath}/*.json`);
totalImported = files.length; totalImported = files.length;