From 9971f15e617f19f1bc72f8b24bb00b72d2a4736f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Thu, 7 Dec 2023 11:15:46 +0200 Subject: [PATCH] Use url of the page if no title available in /connector/saveSnapshot --- .../zotero/xpcom/connector/server_connector.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/xpcom/connector/server_connector.js b/chrome/content/zotero/xpcom/connector/server_connector.js index 4d5a94b332..cd0472e650 100644 --- a/chrome/content/zotero/xpcom/connector/server_connector.js +++ b/chrome/content/zotero/xpcom/connector/server_connector.js @@ -1186,13 +1186,13 @@ Zotero.Server.Connector.SaveSnapshot.prototype = { return item; } - var parser = new DOMParser(); - var doc = parser.parseFromString(`${data.html}`, 'text/html'); - doc = Zotero.HTTP.wrapDocument(doc, data.url); - - let title = doc.title; - if (!data.html) { - title = data.title; + if (data.html) { + var parser = new DOMParser(); + var doc = parser.parseFromString(`${data.html}`, 'text/html'); + doc = Zotero.HTTP.wrapDocument(doc, data.url); + var title = doc.title; + } else { + title = data.title || data.url; } // Create new webpage item