From: Alexander Ebert Date: Wed, 25 Nov 2020 23:25:31 +0000 (+0100) Subject: Improper serialization of `null` values X-Git-Tag: 5.4.0_Alpha_1~586 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7270051449c1a9e877973e921ae4b3d9005003b4;p=GitHub%2FWoltLab%2FWCF.git Improper serialization of `null` values Fixes #3751 --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Core.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Core.js index 27d5f4ef5d..5256fff96b 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Core.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Core.js @@ -164,6 +164,9 @@ define(["require", "exports"], function (require, exports) { * Recursively serializes an object into an encoded URI parameter string. */ function serialize(obj, prefix) { + if (obj === null) { + return ""; + } const parameters = []; Object.keys(obj).forEach((key) => { const parameterKey = prefix ? prefix + "[" + key + "]" : key; diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Core.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Core.ts index 2f74a7adeb..d5635967c3 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Core.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Core.ts @@ -177,8 +177,11 @@ export function getUuid(): string { * Recursively serializes an object into an encoded URI parameter string. */ export function serialize(obj: object, prefix?: string): string { - const parameters: string[] = []; + if (obj === null) { + return ""; + } + const parameters: string[] = []; Object.keys(obj).forEach((key) => { const parameterKey = prefix ? prefix + "[" + key + "]" : key; const value = obj[key];