From 84a9063c4a5b380c1cc9841958091e7ceae20e31 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Tue, 5 Jan 2021 18:35:42 +0100 Subject: [PATCH] Properly handle `null` parameters in `Upload.appendFormData()` --- wcfsetup/install/files/js/WoltLabSuite/Core/Upload.js | 3 +++ wcfsetup/install/files/ts/WoltLabSuite/Core/Upload.ts | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) 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]) => { -- 2.20.1