Manav Rathi 1 рік тому
батько
коміт
f2aee30f7c

+ 2 - 2
web/apps/photos/src/services/download/index.ts

@@ -172,9 +172,9 @@ class DownloadManagerImpl {
             if (!this.ready) {
                 throw Error(CustomError.DOWNLOAD_MANAGER_NOT_READY);
             }
-            const cachedThumb = await this.getCachedThumbnail(file.id);
+            const cachedThumb = await this.thumbnailCache.get(`${file.id}`);
             if (cachedThumb) {
-                return cachedThumb;
+                return new Uint8Array(await cachedThumb.arrayBuffer());
             }
             if (localOnly) {
                 return null;

+ 4 - 0
web/packages/next/blob-cache.ts

@@ -110,6 +110,10 @@ export const openCache = async (
  *
  * Also note that a File is a Blob!
  *
+ * To convert from a Blob to ArrayBuffer
+ *
+ *     await blob.arrayBuffer()
+ *
  * Refs:
  * - https://github.com/yigitunallar/arraybuffer-vs-blob
  * - https://stackoverflow.com/questions/11821096/what-is-the-difference-between-an-arraybuffer-and-a-blob