mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
fix(Email Trigger (IMAP) Node): Fix connection issue with unexpected spaces in host (#6886)
This commit is contained in:
@@ -241,7 +241,7 @@ export class EmailReadImapV1 implements INodeType {
|
||||
imap: {
|
||||
user: credentials.user as string,
|
||||
password: credentials.password as string,
|
||||
host: credentials.host as string,
|
||||
host: (credentials.host as string).trim(),
|
||||
port: credentials.port as number,
|
||||
tls: credentials.secure as boolean,
|
||||
authTimeout: 20000,
|
||||
@@ -250,7 +250,7 @@ export class EmailReadImapV1 implements INodeType {
|
||||
const tlsOptions: IDataObject = {};
|
||||
|
||||
if (credentials.secure) {
|
||||
tlsOptions.servername = credentials.host as string;
|
||||
tlsOptions.servername = (credentials.host as string).trim();
|
||||
}
|
||||
if (!isEmpty(tlsOptions)) {
|
||||
config.imap.tlsOptions = tlsOptions;
|
||||
@@ -527,7 +527,7 @@ export class EmailReadImapV1 implements INodeType {
|
||||
imap: {
|
||||
user: credentials.user as string,
|
||||
password: credentials.password as string,
|
||||
host: credentials.host as string,
|
||||
host: (credentials.host as string).trim(),
|
||||
port: credentials.port as number,
|
||||
tls: credentials.secure as boolean,
|
||||
authTimeout: 20000,
|
||||
@@ -579,7 +579,7 @@ export class EmailReadImapV1 implements INodeType {
|
||||
}
|
||||
|
||||
if (credentials.secure) {
|
||||
tlsOptions.servername = credentials.host as string;
|
||||
tlsOptions.servername = (credentials.host as string).trim();
|
||||
}
|
||||
|
||||
if (!isEmpty(tlsOptions)) {
|
||||
|
||||
@@ -34,14 +34,14 @@ export async function parseRawEmail(
|
||||
): Promise<INodeExecutionData> {
|
||||
const responseData = await simpleParser(messageEncoded);
|
||||
const headers: IDataObject = {};
|
||||
const addidtionalData: IDataObject = {};
|
||||
const additionalData: IDataObject = {};
|
||||
|
||||
for (const header of responseData.headerLines) {
|
||||
headers[header.key] = header.line;
|
||||
}
|
||||
|
||||
addidtionalData.headers = headers;
|
||||
addidtionalData.headerLines = undefined;
|
||||
additionalData.headers = headers;
|
||||
additionalData.headerLines = undefined;
|
||||
|
||||
const binaryData: IBinaryKeyData = {};
|
||||
if (responseData.attachments) {
|
||||
@@ -54,11 +54,11 @@ export async function parseRawEmail(
|
||||
);
|
||||
}
|
||||
|
||||
addidtionalData.attachments = undefined;
|
||||
additionalData.attachments = undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
json: { ...responseData, ...addidtionalData },
|
||||
json: { ...responseData, ...additionalData },
|
||||
binary: Object.keys(binaryData).length ? binaryData : undefined,
|
||||
} as INodeExecutionData;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ export class EmailReadImapV2 implements INodeType {
|
||||
imap: {
|
||||
user: credentials.user,
|
||||
password: credentials.password,
|
||||
host: credentials.host,
|
||||
host: credentials.host.trim(),
|
||||
port: credentials.port,
|
||||
tls: credentials.secure,
|
||||
authTimeout: 20000,
|
||||
@@ -251,7 +251,7 @@ export class EmailReadImapV2 implements INodeType {
|
||||
}
|
||||
|
||||
if (credentials.secure) {
|
||||
tlsOptions.servername = credentials.host;
|
||||
tlsOptions.servername = credentials.host.trim();
|
||||
}
|
||||
if (!isEmpty(tlsOptions)) {
|
||||
config.imap.tlsOptions = tlsOptions;
|
||||
@@ -554,7 +554,7 @@ export class EmailReadImapV2 implements INodeType {
|
||||
imap: {
|
||||
user: credentials.user,
|
||||
password: credentials.password,
|
||||
host: credentials.host,
|
||||
host: credentials.host.trim(),
|
||||
port: credentials.port,
|
||||
tls: credentials.secure,
|
||||
authTimeout: 20000,
|
||||
@@ -609,7 +609,7 @@ export class EmailReadImapV2 implements INodeType {
|
||||
}
|
||||
|
||||
if (credentials.secure) {
|
||||
tlsOptions.servername = credentials.host;
|
||||
tlsOptions.servername = credentials.host.trim();
|
||||
}
|
||||
|
||||
if (!isEmpty(tlsOptions)) {
|
||||
@@ -648,7 +648,7 @@ export class EmailReadImapV2 implements INodeType {
|
||||
|
||||
let reconnectionInterval: NodeJS.Timeout | undefined;
|
||||
|
||||
const handleReconect = async () => {
|
||||
const handleReconnect = async () => {
|
||||
this.logger.verbose('Forcing reconnect to IMAP server');
|
||||
try {
|
||||
isCurrentlyReconnecting = true;
|
||||
@@ -665,12 +665,12 @@ export class EmailReadImapV2 implements INodeType {
|
||||
|
||||
if (options.forceReconnect !== undefined) {
|
||||
reconnectionInterval = setInterval(
|
||||
handleReconect,
|
||||
handleReconnect,
|
||||
(options.forceReconnect as number) * 1000 * 60,
|
||||
);
|
||||
}
|
||||
|
||||
// When workflow and so node gets set to inactive close the connectoin
|
||||
// When workflow and so node gets set to inactive close the connection
|
||||
async function closeFunction() {
|
||||
closeFunctionWasCalled = true;
|
||||
if (reconnectionInterval) {
|
||||
|
||||
Reference in New Issue
Block a user