Accept non-integer attachmentLastPageIndex

This commit is contained in:
Abe Jellinek 2023-05-12 22:30:01 +03:00 committed by Dan Stillman
parent 89adf56eed
commit b6d0ad3e05

View file

@ -3405,7 +3405,7 @@ Zotero.Item.prototype.getAttachmentLastPageIndex = function () {
var id = this._getLastPageIndexSettingKey();
var val = Zotero.SyncedSettings.get(Zotero.Libraries.userLibraryID, id);
if (val !== null && (typeof val != 'number' || val != parseInt(val))) {
if (this.isPDFAttachment() && val !== null && (typeof val != 'number' || val != parseInt(val))) {
Zotero.logError(`Setting contains an invalid attachment page index ('${val}') -- discarding`);
return null;
}
@ -3417,7 +3417,7 @@ Zotero.Item.prototype.setAttachmentLastPageIndex = async function (val) {
throw new Error("setAttachmentLastPageIndex() can only be called on file attachments");
}
if (typeof val != 'number' || val != parseInt(val)) {
if (this.isPDFAttachment() && (typeof val != 'number' || val != parseInt(val))) {
Zotero.debug(val, 2);
throw new Error(`setAttachmentLastPageIndex() must be passed an integer`);
}