From 7270051449c1a9e877973e921ae4b3d9005003b4 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 26 Nov 2020 00:25:31 +0100 Subject: [PATCH] Improper serialization of `null` values Fixes #3751 --- wcfsetup/install/files/js/WoltLabSuite/Core/Core.js | 3 +++ wcfsetup/install/files/ts/WoltLabSuite/Core/Core.ts | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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]; -- 2.20.1