mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix: Credential overwrites should take precedence over credential default values (#4782)
fix: Credential overwrites should take precedence over default values
This commit is contained in:
parent
0c759dc548
commit
2ce62917da
|
@ -358,9 +358,6 @@ export class CredentialsHelper extends ICredentialsHelper {
|
|||
|
||||
/**
|
||||
* Applies credential default data and overwrites
|
||||
*
|
||||
* @param {ICredentialDataDecryptedObject} decryptedDataOriginal The credential data to overwrite data on
|
||||
* @param {string} type Type of the credentials to overwrite data of
|
||||
*/
|
||||
applyDefaultsAndOverwrites(
|
||||
decryptedDataOriginal: ICredentialDataDecryptedObject,
|
||||
|
@ -371,10 +368,13 @@ export class CredentialsHelper extends ICredentialsHelper {
|
|||
): ICredentialDataDecryptedObject {
|
||||
const credentialsProperties = this.getCredentialsProperties(type);
|
||||
|
||||
// Load and apply the credentials overwrites if any exist
|
||||
const dataWithOverwrites = CredentialsOverwrites().applyOverwrite(type, decryptedDataOriginal);
|
||||
|
||||
// Add the default credential values
|
||||
let decryptedData = NodeHelpers.getNodeParameters(
|
||||
credentialsProperties,
|
||||
decryptedDataOriginal as INodeParameters,
|
||||
dataWithOverwrites as INodeParameters,
|
||||
true,
|
||||
false,
|
||||
null,
|
||||
|
@ -431,10 +431,7 @@ export class CredentialsHelper extends ICredentialsHelper {
|
|||
) as ICredentialDataDecryptedObject;
|
||||
}
|
||||
|
||||
// Load and apply the credentials overwrites if any exist
|
||||
const credentialsOverwrites = CredentialsOverwrites();
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return credentialsOverwrites.applyOverwrite(type, decryptedData);
|
||||
return decryptedData;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -51,7 +51,6 @@ class CredentialsOverwritesClass {
|
|||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return returnData;
|
||||
}
|
||||
|
||||
|
@ -74,7 +73,6 @@ class CredentialsOverwritesClass {
|
|||
}
|
||||
|
||||
const overwrites: ICredentialDataDecryptedObject = {};
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const credentialsTypeName of credentialTypeData.extends) {
|
||||
Object.assign(overwrites, this.getOverwrites(credentialsTypeName));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue