From bbdbcc115e8c04b831f5a2570300b7af9c3c78be Mon Sep 17 00:00:00 2001 From: Cyperghost Date: Mon, 16 Dec 2024 13:13:59 +0100 Subject: [PATCH] Unset `uploadResolve` --- .../Core/Form/Builder/Field/Controller/FileProcessor.ts | 5 ++++- .../Core/Form/Builder/Field/Controller/FileProcessor.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ts/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.ts b/ts/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.ts index a22930b908..18e541f2b6 100644 --- a/ts/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.ts +++ b/ts/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.ts @@ -67,7 +67,8 @@ export class FileProcessor { if (this.#simpleReplace) { this.#uploadButton.addEventListener("shouldUpload", () => { - const file = this.#uploadButton.parentElement!.querySelector("woltlab-core-file"); + const file = + this.#uploadButton.parentElement!.querySelector("woltlab-core-file[file-id]"); if (!file) { return; } @@ -168,6 +169,7 @@ export class FileProcessor { this.#uploadButton.dataset.context = oldContext; this.#registerFile(this.#replaceElement!); this.#replaceElement = undefined; + this.#uploadResolve = undefined; this.#fileInput.removeEventListener("change", changeEventListener); }; @@ -216,6 +218,7 @@ export class FileProcessor { const oldContext = this.#startReplaceFile(oldFile); const cropCancelledEvent = () => { + this.#uploadResolve = undefined; this.#uploadButton.dataset.context = oldContext; this.#registerFile(this.#replaceElement!); this.#replaceElement = undefined; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.js index 6aac75c57a..a9badcb066 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.js @@ -39,7 +39,7 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Language", "WoltLabSui this.#uploadButton = this.#container.querySelector("woltlab-core-file-upload"); if (this.#simpleReplace) { this.#uploadButton.addEventListener("shouldUpload", () => { - const file = this.#uploadButton.parentElement.querySelector("woltlab-core-file"); + const file = this.#uploadButton.parentElement.querySelector("woltlab-core-file[file-id]"); if (!file) { return; } @@ -123,6 +123,7 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Language", "WoltLabSui this.#uploadButton.dataset.context = oldContext; this.#registerFile(this.#replaceElement); this.#replaceElement = undefined; + this.#uploadResolve = undefined; this.#fileInput.removeEventListener("change", changeEventListener); }; this.#fileInput.addEventListener("cancel", cancelEventListener, { once: true }); @@ -163,6 +164,7 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Language", "WoltLabSui #simpleFileReplace(oldFile) { const oldContext = this.#startReplaceFile(oldFile); const cropCancelledEvent = () => { + this.#uploadResolve = undefined; this.#uploadButton.dataset.context = oldContext; this.#registerFile(this.#replaceElement); this.#replaceElement = undefined; -- 2.20.1