Incorrect handling of `null` values for metacode attributes
authorAlexander Ebert <ebert@woltlab.com>
Tue, 3 Aug 2021 15:17:12 +0000 (17:17 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 3 Aug 2021 15:17:12 +0000 (17:17 +0200)
ts/WoltLabSuite/Core/Ui/Redactor/Metacode.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Metacode.js

index 71c8047d25b550e3b409845a27fb3d7b54d6ecf0..6a1f8f50b62f95e7cdabaf62719089251d5bdaa3 100644 (file)
@@ -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");
   });
 }
index 05292f29e4c5dbdf30ad35ad9a67f9279119c7cd..9a947f89c9561f0da173adecbcb00305a3a62144 100644 (file)
@@ -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");
         });
     }