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:
parent
20d13f5a8e
commit
a0da169664
1 changed files with 5 additions and 1 deletions
|
@ -206,9 +206,13 @@ var Zotero_Tabs = new function () {
|
||||||
}
|
}
|
||||||
else if (tab.type === 'reader') {
|
else if (tab.type === 'reader') {
|
||||||
if (Zotero.Items.exists(tab.data.itemID)) {
|
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({
|
this.add({
|
||||||
type: 'reader-unloaded',
|
type: 'reader-unloaded',
|
||||||
title: tab.title,
|
title,
|
||||||
index: i,
|
index: i,
|
||||||
data: tab.data,
|
data: tab.data,
|
||||||
select: tab.selected
|
select: tab.selected
|
||||||
|
|
Loading…
Add table
Reference in a new issue