Skip to content

Commit

Permalink
Fix bug for empty title when a translator does not provide one.
Browse files Browse the repository at this point in the history
  • Loading branch information
fletcherhaz committed Nov 3, 2020
1 parent a2620b7 commit c0ec91f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions chrome/content/zotero/xpcom/attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,15 @@ Zotero.Attachments = new function(){
if (parentItemID && collections) {
throw new Error("parentItemID and parentCollectionIDs cannot both be provided");
}

// If no title was provided, pull it from the document
if (!title) {
let parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
.createInstance(Components.interfaces.nsIDOMParser);
parser.init(null, Services.io.newURI(url));
let doc = parser.parseFromString(snapshotContent, 'text/html');
title = doc.title;
}

let tmpDirectory = (await this.createTemporaryStorageDirectory()).path;
let destDirectory;
Expand Down

0 comments on commit c0ec91f

Please sign in to comment.