mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
feat: detect if blob too large (#1738)
This commit is contained in:
@@ -302,6 +302,10 @@ export function createWorkspaceApis(prefixUrl = '/') {
|
||||
): Promise<string> => {
|
||||
const auth = getLoginStorage();
|
||||
assertExists(auth);
|
||||
const mb = arrayBuffer.byteLength / 1048576;
|
||||
if (mb > 10) {
|
||||
throw new RequestError(MessageCode.blobTooLarge);
|
||||
}
|
||||
return fetch(prefixUrl + 'api/blob', {
|
||||
method: 'PUT',
|
||||
body: arrayBuffer,
|
||||
|
||||
Reference in New Issue
Block a user