Load PDF file from URI to avoid keeping extra file copy in memory

This commit is contained in:
Martynas Bagdonas 2023-09-15 11:05:31 +02:00
parent 0e5359d43e
commit 1b23838d37
2 changed files with 5 additions and 2 deletions

View file

@ -531,7 +531,10 @@ class ReaderInstance {
if (fileSize > ARRAYBUFFER_MAX_LENGTH) {
throw new Error(`The file "${path}" is too large`);
}
let buf = await OS.File.read(path, {});
let buf;
if (this._type !== 'pdf') {
buf = await OS.File.read(path, {});
}
let baseURI = `zotero://attachment/${Zotero.API.getLibraryPrefix(item.libraryID)}/items/${item.key}/`;
return {
buf,

2
reader

@ -1 +1 @@
Subproject commit 005a88eb6cfcfdc808395f3e865040fe33715183
Subproject commit 81863a19d7f62685e6c3ab8ce893647b9dfb7351