More attachment box fixes

- Only try to show preview or check file existence for file attachments
- Use fileExists() for file check
- Show Accessed for linked-URL attachments
This commit is contained in:
Dan Stillman 2024-01-14 02:46:21 -05:00
parent 61a5704dd4
commit 0c089efd8a
2 changed files with 4 additions and 4 deletions

View file

@ -259,7 +259,7 @@
let indexStatusRow = this._id('indexStatusRow');
let selectButton = this._id('select-button');
let fileExists = await IOUtils.exists(this._item.getFilePath());
let fileExists = this._item.isFileAttachment() && await this._item.fileExists();
let isImportedURL = this.item.attachmentLinkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL;
let isLinkedURL = this.item.attachmentLinkMode == Zotero.Attachments.LINK_MODE_LINKED_URL;
@ -287,7 +287,7 @@
}
// Access date
if (this.displayAccessed && isImportedURL) {
if (this.displayAccessed && (isImportedURL || isLinkedURL)) {
let itemAccessDate = this.item.getField('accessDate');
if (itemAccessDate) {
itemAccessDate = Zotero.Date.sqlToDate(itemAccessDate, true);

View file

@ -98,7 +98,7 @@
}
set item(val) {
this._item = (val instanceof Zotero.Item && val.isAttachment()) ? val : null;
this._item = (val instanceof Zotero.Item && val.isFileAttachment()) ? val : null;
if (this.isVisible) {
this.render();
}
@ -200,7 +200,7 @@
}
this._renderingItemID = itemID;
let success = false;
if (this.isValidType && await IOUtils.exists(this._item.getFilePath())) {
if (this.isValidType && await this._item.fileExists()) {
if (this.isReaderType) {
success = await this._renderReader();
}