Skip to content

armgit / ente

Public Imported from GitHub
0

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

res2

Manav Rathi997c74d064f3
diff --git a/web/apps/photos/src/services/download/index.ts b/web/apps/photos/src/services/download/index.ts
index 4a1f4706d8..fd1771aebf 100644
--- a/web/apps/photos/src/services/download/index.ts
+++ b/web/apps/photos/src/services/download/index.ts
@@ -316,14 +316,16 @@ class DownloadManagerImpl {
}
}
- let resp: Response = await this.getCachedFile(file);
- if (!resp) {
- resp = await this.downloadClient.downloadFileStream(file);
- this?.fileCache.put(cacheKey, resp.clone());
+ const cachedBlob = await this.fileCache?.get(cacheKey);
+ let res: Response;
+ if (cachedBlob) res = new Response(cachedBlob);
+ else {
+ res = await this.downloadClient.downloadFileStream(file);
+ this?.fileCache.put2(cacheKey, await res.blob());
}
- const reader = resp.body.getReader();
+ const reader = res.body.getReader();
- const contentLength = +resp.headers.get("Content-Length") ?? 0;
+ const contentLength = +res.headers.get("Content-Length") ?? 0;
let downloadedBytes = 0;
const stream = new ReadableStream({