Normalize root comment keys before rendering

This commit is contained in:
thePR0M3TH3AN committed 2025-11-04 15:06:17 -05:00
1 parent a52e1e2a17
commit cac275a220
2 files changed
+23 -2

No files matched your search

+6 -1
View File
@@ -1815,7 +1815,12 @@ export class VideoModal {
}
if (typeof value === "string") {
const trimmed = value.trim();
if (!trimmed || trimmed === "null" || trimmed === "undefined") {
if (
!trimmed ||
trimmed === "null" ||
trimmed === "undefined" ||
trimmed === "__root__"
) {
return null;
}
return trimmed;
+17 -1
View File
@@ -458,8 +458,24 @@ export default class VideoModalCommentController {
input instanceof Map ? input : this.createMapFromInput(input);
const result = new Map();
source.forEach((value, key) => {
let normalizedKey = key;
if (normalizedKey === null || normalizedKey === undefined) {
normalizedKey = null;
} else if (typeof normalizedKey === "string") {
const trimmed = normalizedKey.trim();
if (
!trimmed ||
trimmed === "null" ||
trimmed === "undefined" ||
trimmed === "__root__"
) {
normalizedKey = null;
} else {
normalizedKey = trimmed;
}
}
const list = Array.isArray(value) ? value.filter(Boolean) : [];
result.set(key, list);
result.set(normalizedKey, list);
});
return result;
}