Use url of the page if no title available in /connector/saveSnapshot

This commit is contained in:
Adomas Venčkauskas 2023-12-07 11:15:46 +02:00
parent 5a0f369f0b
commit 9971f15e61

View file

@ -1186,13 +1186,13 @@ Zotero.Server.Connector.SaveSnapshot.prototype = {
return item;
}
var parser = new DOMParser();
var doc = parser.parseFromString(`<html>${data.html}</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(`<html>${data.html}</html>`, 'text/html');
doc = Zotero.HTTP.wrapDocument(doc, data.url);
var title = doc.title;
} else {
title = data.title || data.url;
}
// Create new webpage item