From e6f90270150794863d7ac24ec3dc29f8cd97f597 Mon Sep 17 00:00:00 2001 From: johnqiao Date: Sat, 25 Nov 2023 01:47:22 -0700 Subject: [PATCH] Fix filename issue --- js/comfyui-share-openart.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/comfyui-share-openart.js b/js/comfyui-share-openart.js index 11e65d92..6bcbcaeb 100644 --- a/js/comfyui-share-openart.js +++ b/js/comfyui-share-openart.js @@ -583,10 +583,13 @@ export class OpenArtShareDialog extends ComfyDialog { potential_outputs.map((output, index) => { const radio_button = $el("input", { type: 'radio', name: "selectOutputImages", value: index, required: index === 0 }, []) let radio_button_img; + let filename; if (output.type === "image" || output.type === "temp") { radio_button_img = $el("img", { src: `/view?filename=${output.image.filename}&subfolder=${output.image.subfolder}&type=${output.image.type}`, style: { width: "100px", height: "100px", objectFit: "cover", borderRadius: "5px" } }, []); + filename = output.image.filename } else if (output.type === "output") { radio_button_img = $el("img", { src: output.output.value, style: { width: "auto", height: "100px", objectFit: "cover", borderRadius: "5px" } }, []); + filename = output.filename } else { // unsupported output type // this should never happen @@ -634,7 +637,7 @@ export class OpenArtShareDialog extends ComfyDialog { radio_button.parentElement.classList.add("checked"); this.fetchImageBlob(radio_button_img.src).then((blob) => { - const file = new File([blob], output.image.filename, { + const file = new File([blob], filename, { type: blob.type, }); this.previewImage.src = radio_button_img.src; @@ -645,7 +648,7 @@ export class OpenArtShareDialog extends ComfyDialog { if (radio_button.checked) { this.fetchImageBlob(radio_button_img.src).then((blob) => { - const file = new File([blob], output.image.filename, { + const file = new File([blob], filename, { type: blob.type, }); this.previewImage.src = radio_button_img.src;