From 0df8b7670d7536bc496a99830ff8ad51b136f425 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 9 Apr 2022 06:20:47 -0400 Subject: [PATCH] Fix broken tag selector with colored tags that differ with normalization https://forums.zotero.org/discussion/96138/lost-content-in-tag-selector An entered character from the CJK_COMPATIBILITY_IDEOGRAPHS block (char code 63834, or similar) was normalized to the CJK_UNIFIED_IDEOGRAPHS block (char code 35712), which then caused an expected key not to exist. To fix, normalize colored tag values coming from the DB. --- chrome/content/zotero/xpcom/data/tags.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/data/tags.js b/chrome/content/zotero/xpcom/data/tags.js index 59b6a5e580..36a90bf1bd 100644 --- a/chrome/content/zotero/xpcom/data/tags.js +++ b/chrome/content/zotero/xpcom/data/tags.js @@ -591,6 +591,8 @@ Zotero.Tags = new function() { } var tagColors = Zotero.SyncedSettings.get(libraryID, 'tagColors') || []; + // Normalize tags from DB, which might not have been normalized properly previously + tagColors.forEach(x => x.name = x.name.normalize()); _libraryColors[libraryID] = tagColors; _libraryColorsByName[libraryID] = new Map; @@ -619,7 +621,7 @@ Zotero.Tags = new function() { this.getColors(libraryID); var tagColors = _libraryColors[libraryID]; - name = name.trim(); + name = name.trim().normalize(); // Unset if (!color) {