fix(workspace): fix svg display on browser (#5158)

This commit is contained in:
EYHN
2023-12-02 17:27:07 +00:00
parent 661b4a91ba
commit 91f3149148
2 changed files with 4 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ import {
import { fetcher } from '@affine/workspace/affine/gql';
import type { BlobStorage } from '../engine';
import { bufferToBlob } from '../util';
export const createAffineCloudBlobStorage = (
workspaceId: string
@@ -26,7 +27,7 @@ export const createAffineCloudBlobStorage = (
// status not in the range 200-299
return undefined;
}
return await res.blob();
return bufferToBlob(await res.arrayBuffer());
}
);
},

View File

@@ -1,6 +1,7 @@
import { createStore, del, get, keys, set } from 'idb-keyval';
import type { BlobStorage } from '../engine';
import { bufferToBlob } from '../util';
export const createIndexeddbBlobStorage = (
workspaceId: string
@@ -13,7 +14,7 @@ export const createIndexeddbBlobStorage = (
get: async (key: string) => {
const res = await get<ArrayBuffer>(key, db);
if (res) {
return new Blob([res], { type: await get(key, mimeTypeDb) });
return bufferToBlob(res);
}
return undefined;
},