From: Alexander Ebert Date: Tue, 3 Aug 2021 15:17:12 +0000 (+0200) Subject: Incorrect handling of `null` values for metacode attributes X-Git-Tag: 5.4.3~28 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0d1ac907cb725396ed25fddcfae09705eece8575;p=GitHub%2FWoltLab%2FWCF.git Incorrect handling of `null` values for metacode attributes --- diff --git a/ts/WoltLabSuite/Core/Ui/Redactor/Metacode.ts b/ts/WoltLabSuite/Core/Ui/Redactor/Metacode.ts index 71c8047d25..6a1f8f50b6 100644 --- a/ts/WoltLabSuite/Core/Ui/Redactor/Metacode.ts +++ b/ts/WoltLabSuite/Core/Ui/Redactor/Metacode.ts @@ -101,7 +101,11 @@ function parseAttributes(attributes: string): Attributes { return []; } - return attributes.map((attribute: string | number) => { + return attributes.map((attribute: string | number | null) => { + if (attribute === null) { + return ""; + } + return attribute.toString().replace(/^'(.*)'$/, "$1"); }); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js index 05292f29e4..9a947f89c9 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js @@ -95,6 +95,9 @@ define(["require", "exports", "tslib", "../../Event/Handler", "../../Dom/Util", return []; } return attributes.map((attribute) => { + if (attribute === null) { + return ""; + } return attribute.toString().replace(/^'(.*)'$/, "$1"); }); }