diff --git a/web/apps/photos/src/services/download/index.ts b/web/apps/photos/src/services/download/index.ts index 4a1f4706d..fd1771aeb 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({