From 0d1ac907cb725396ed25fddcfae09705eece8575 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 3 Aug 2021 17:17:12 +0200 Subject: [PATCH] Incorrect handling of `null` values for metacode attributes --- ts/WoltLabSuite/Core/Ui/Redactor/Metacode.ts | 6 +++++- .../files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) 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"); }); } -- 2.20.1