Strip non-printable characters in tab titles when restoring session

https://forums.zotero.org/discussion/118303/zotero-blocked-with-the-loading-items-message
and probably others

Fixes #4721
This commit is contained in:
Dan Stillman 2024-10-02 00:37:27 -04:00
parent 20d13f5a8e
commit a0da169664

View file

@ -206,9 +206,13 @@ var Zotero_Tabs = new function () {
}
else if (tab.type === 'reader') {
if (Zotero.Items.exists(tab.data.itemID)) {
// Strip non-printable characters, which can result in DOM syntax errors
// ("An invalid or illegal string was specified") -- reproduced with "\u0001"
// in a title in session.json
let title = tab.title.replace(/[\u0000-\u001F\u007F-\u009F]/g, "");
this.add({
type: 'reader-unloaded',
title: tab.title,
title,
index: i,
data: tab.data,
select: tab.selected