mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix: Fix issue with key formatting introduced in 1.2.0 (#6896)
This commit is contained in:
parent
3d2f4406d7
commit
0e075c9cb5
|
@ -3,7 +3,6 @@ import { formatPrivateKey } from '@utils/utilities';
|
|||
|
||||
import mysql2 from 'mysql2/promise';
|
||||
import type { Client, ConnectConfig } from 'ssh2';
|
||||
import { rm } from 'fs/promises';
|
||||
|
||||
import type { Mysql2Pool } from '../helpers/interfaces';
|
||||
|
||||
|
@ -107,12 +106,6 @@ export async function createPool(
|
|||
dstPort: credentials.port as number,
|
||||
};
|
||||
|
||||
if (sshAuthenticateWith === 'privateKey') {
|
||||
sshClient.on('end', async () => {
|
||||
await rm(tunnelConfig.privateKey as string);
|
||||
});
|
||||
}
|
||||
|
||||
const poolSetup = new Promise<mysql2.Pool>((resolve, reject) => {
|
||||
sshClient
|
||||
.on('ready', () => {
|
||||
|
|
|
@ -8,9 +8,6 @@ import type { Server } from 'net';
|
|||
import { createServer } from 'net';
|
||||
|
||||
import pgPromise from 'pg-promise';
|
||||
|
||||
import { rm } from 'fs/promises';
|
||||
|
||||
import type { PgpDatabase } from '../helpers/interfaces';
|
||||
|
||||
async function createSshConnectConfig(credentials: IDataObject) {
|
||||
|
@ -143,9 +140,6 @@ export async function configurePostgres(
|
|||
});
|
||||
|
||||
sshClient.on('end', async () => {
|
||||
if (tunnelConfig.privateKey) {
|
||||
await rm(tunnelConfig.privateKey as string, { force: true });
|
||||
}
|
||||
if (proxy) proxy.close();
|
||||
});
|
||||
}).catch((err) => {
|
||||
|
|
|
@ -236,11 +236,9 @@ export function formatPrivateKey(privateKey: string): string {
|
|||
const passRegex = /Proc-Type|DEK-Info/;
|
||||
if (passRegex.test(part)) {
|
||||
part = part.replace(/:\s+/g, ':');
|
||||
formattedPrivateKey += part.replace(/\\n/g, '\n');
|
||||
formattedPrivateKey += part.replace(/\s+/g, '\n');
|
||||
formattedPrivateKey += part.replace(/\\n/g, '\n').replace(/\s+/g, '\n');
|
||||
} else {
|
||||
formattedPrivateKey += part.replace(/\\n/g, '\n');
|
||||
formattedPrivateKey += part.replace(/\s+/g, '\n');
|
||||
formattedPrivateKey += part.replace(/\\n/g, '\n').replace(/\s+/g, '\n');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
lockfileVersion: '6.0'
|
||||
lockfileVersion: '6.1'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
|
|
Loading…
Reference in a new issue