Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix in-memory cache checked before download

Abhinav6e355fbd2301
diff --git a/apps/photos/src/services/download/index.ts b/apps/photos/src/services/download/index.ts
index 1b8c22a58a..f0e14cd167 100644
--- a/apps/photos/src/services/download/index.ts
+++ b/apps/photos/src/services/download/index.ts
@@ -228,9 +228,6 @@ class DownloadManager {
if (!this.ready) {
throw Error(CustomError.DOWNLOAD_MANAGER_NOT_READY);
}
- if (!cacheInMemory) {
- return await this.downloadFile(file);
- }
const getFilePromise = async (): Promise<SourceURLs> => {
const fileStream = await this.downloadFile(file);
const fileBlob = await new Response(fileStream).blob();
@@ -241,6 +238,9 @@ class DownloadManager {
};
};
if (!this.fileObjectURLPromises.has(file.id)) {
+ if (!cacheInMemory) {
+ return await this.downloadFile(file);
+ }
this.fileObjectURLPromises.set(file.id, getFilePromise());
}
const fileURLs = await this.fileObjectURLPromises.get(file.id);