From: Matthias Schmidt Date: Tue, 5 Jan 2021 17:35:42 +0000 (+0100) Subject: Properly handle `null` parameters in `Upload.appendFormData()` X-Git-Tag: 5.4.0_Alpha_1~461^2~18 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=84a9063c4a5b380c1cc9841958091e7ceae20e31;p=GitHub%2FWoltLab%2FWCF.git Properly handle `null` parameters in `Upload.appendFormData()` --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Upload.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Upload.js index 5fb7bdcb35..b97bf49df0 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Upload.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Upload.js @@ -281,6 +281,9 @@ define(["require", "exports", "tslib", "./Ajax/Request", "./Core", "./Dom/Change } // recursively append additional parameters to form data function appendFormData(parameters, prefix) { + if (parameters === null) { + return; + } prefix = prefix || ""; Object.entries(parameters).forEach(([key, value]) => { if (typeof value === "object") { diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Upload.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Upload.ts index 801f0a9374..c89015a677 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Upload.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Upload.ts @@ -349,7 +349,11 @@ abstract class Upload { } // recursively append additional parameters to form data - function appendFormData(parameters: object, prefix?: string): void { + function appendFormData(parameters: object | null, prefix?: string): void { + if (parameters === null) { + return; + } + prefix = prefix || ""; Object.entries(parameters).forEach(([key, value]) => {