From 6a30e0d840c1f608bb8d533134b1ab62fa88248f Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Sat, 31 Oct 2026 13:55:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=96=B0=E5=BB=BA=E9=80=89=E5=9B=BE):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8E=9F=E7=94=9F=E9=80=89=E5=9B=BE=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/webui/ofdgo_host.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/assets/webui/ofdgo_host.js b/assets/webui/ofdgo_host.js index 1cec77f..1a0cd5b 100644 --- a/assets/webui/ofdgo_host.js +++ b/assets/webui/ofdgo_host.js @@ -824,11 +824,14 @@ class NativeHost { event.preventDefault(); try { const files = (await this.call("open", {multiple:input.multiple, directory:input.webkitdirectory, accept:input.accept})).map(value => new NativeFile(value)); - if (!files.length) return; + if (!files.length) { input.dispatchEvent(new Event("cancel", {bubbles:true})); return; } setInputFiles(input, files); input.dispatchEvent(new Event("input", {bubbles:true})); input.dispatchEvent(new Event("change", {bubbles:true})); - } catch (error) { if (error.name !== "AbortError") onError(error); } + } catch (error) { + if (error.name === "AbortError") input.dispatchEvent(new Event("cancel", {bubbles:true})); + else onError(error); + } }, true); }