Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blobOptionsGetter shouldn't have a default to API #2147

Closed
pionxzh opened this issue Apr 18, 2023 · 1 comment
Closed

blobOptionsGetter shouldn't have a default to API #2147

pionxzh opened this issue Apr 18, 2023 · 1 comment
Labels
type:feat Non-bug feature improvements

Comments

@pionxzh
Copy link
Contributor

pionxzh commented Apr 18, 2023

When I import markdown by:

const contentParser = new ContentParser(page)
const pageBlockId = page.addBlock('affine:page')
const frameId = page.addBlock('affine:frame', {}, pageBlockId)
contentParser.importMarkdown(markdown, frameId)
//             ^^^^^^^^^^^^

If there are any image element, it will automatically call workspace.blobs (the BlobStorage) to store the blob.

But the default value of _blobOptionsGetter caused the parser to send a request to /api/workspace/{workspace_id}/blob to persistent the blob on the server, which shouldn't be enabled by default.

See

const id = await storage.set(imgBlob);

private _blobOptionsGetter?: BlobOptionsGetter = (k: string) =>
({ api: '/api/workspace' }[k]);

Current workaround

const workspace = new Workspace({
    id: workspaceId,
    providers: [],
+   blobOptionsGetter: () => undefined,
})
@doodlewind doodlewind added the type:feat Non-bug feature improvements label Apr 24, 2023
@doodlewind
Copy link
Member

Closed by #2169

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feat Non-bug feature improvements
Projects
Archived in project
Development

No branches or pull requests

2 participants