From 3eef4284d17fc650270e0116ce86bc6d3b010e6b Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 19 Aug 2023 04:00:21 -0400 Subject: [PATCH] Fix "Filename" tab title option https://forums.zotero.org/discussion/comment/441259/#Comment_441259 --- chrome/content/zotero/xpcom/reader.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index e9b36f7fad..4ccd7e87a1 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -544,8 +544,13 @@ class ReaderInstance { let item = Zotero.Items.get(this._item.id); let readerTitle = item.getDisplayTitle(); let parentItem = item.parentItem; - // If type is "filename", then readerTitle already has it - if (parentItem && type !== 'filename') { + if (type === 'filename') { + let attachment = await parentItem.getBestAttachment(); + if (attachment && attachment.id === this._item.id) { + readerTitle = attachment.attachmentFilename; + } + } + else if (parentItem) { let attachment = await parentItem.getBestAttachment(); if (attachment && attachment.id === this._item.id) { let parts = [];