mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(editor): Remove unknown credentials on pasting workflow (#7582)
https://linear.app/n8n/issue/PAY-881
This commit is contained in:
@@ -1677,6 +1677,8 @@ export default defineComponent({
|
||||
});
|
||||
}
|
||||
|
||||
this.removeUnknownCredentials(workflowData);
|
||||
|
||||
const currInstanceId = this.rootStore.instanceId;
|
||||
|
||||
const nodeGraph = JSON.stringify(
|
||||
@@ -1756,6 +1758,23 @@ export default defineComponent({
|
||||
this.showError(error, this.$locale.baseText('nodeView.showError.importWorkflowData.title'));
|
||||
}
|
||||
},
|
||||
|
||||
removeUnknownCredentials(workflow: IWorkflowToShare) {
|
||||
if (!workflow?.nodes) return;
|
||||
|
||||
for (const node of workflow.nodes) {
|
||||
if (!node.credentials) continue;
|
||||
|
||||
for (const [name, credential] of Object.entries(node.credentials)) {
|
||||
if (credential.id === null) continue;
|
||||
|
||||
if (!this.credentialsStore.getCredentialById(credential.id)) {
|
||||
delete node.credentials[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onDragOver(event: DragEvent) {
|
||||
event.preventDefault();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user