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:
कारतोफ्फेलस्क्रिप्ट™ 2022-12-02 09:46:19 +01:00 committed by GitHub
parent 0c759dc548
commit 2ce62917da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 10 deletions

View file

@ -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;
}
/**

View file

@ -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));
}