From 9be066014ebb28b50bd1d8a710b593cde7099c8f Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Wed, 20 Mar 2024 19:28:43 +0000 Subject: [PATCH] Fix export name --- web/scripts/ui/menu/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/scripts/ui/menu/index.js b/web/scripts/ui/menu/index.js index 44befe2ef..98454bbf2 100644 --- a/web/scripts/ui/menu/index.js +++ b/web/scripts/ui/menu/index.js @@ -53,7 +53,7 @@ export class ComfyAppMenu { icon: "download", content: "Export", tooltip: "Export the current workflow as JSON", - action: () => this.exportWorkflow("workflow", "workflow"), + action: () => this.exportWorkflow( "workflow", "workflow"), }), new ComfyButton({ icon: "api", @@ -254,10 +254,14 @@ export class ComfyAppMenu { * @param { "workflow" | "output" } [promptProperty] */ async exportWorkflow(filename, promptProperty) { + if(this.app.workflowManager.activeWorkflow?.path) { + filename = this.app.workflowManager.activeWorkflow.name; + } const p = await this.app.graphToPrompt(); const json = JSON.stringify(p[promptProperty], null, 2); const blob = new Blob([json], { type: "application/json" }); const file = this.getFilename(filename); + if(!file) return; downloadBlob(file, blob); } }