mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-26 17:03:46 +03:00
fix(core): image block size limits were not enforced as expected (#8908)
This commit is contained in:
parent
08ff619d47
commit
4ce8a180aa
@ -7,6 +7,7 @@ import {
|
||||
import {
|
||||
AttachmentBlockService,
|
||||
AttachmentBlockSpec,
|
||||
ImageBlockService,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import bytes from 'bytes';
|
||||
|
||||
@ -19,6 +20,15 @@ class CustomAttachmentBlockService extends AttachmentBlockService {
|
||||
}
|
||||
}
|
||||
|
||||
class CustomImageBlockService extends ImageBlockService {
|
||||
override mounted(): void {
|
||||
// blocksuite default max file size is 10MB, we override it to 2GB
|
||||
// but the real place to limit blob size is CloudQuotaModal / LocalQuotaModal
|
||||
this.maxFileSize = bytes.parse('2GB');
|
||||
super.mounted();
|
||||
}
|
||||
}
|
||||
|
||||
export const CustomAttachmentBlockSpec: ExtensionType[] = [
|
||||
...AttachmentBlockSpec,
|
||||
{
|
||||
@ -28,6 +38,11 @@ export const CustomAttachmentBlockSpec: ExtensionType[] = [
|
||||
CustomAttachmentBlockService,
|
||||
[StdIdentifier, BlockFlavourIdentifier('affine:attachment')]
|
||||
);
|
||||
di.override(
|
||||
BlockServiceIdentifier('affine:image'),
|
||||
CustomImageBlockService,
|
||||
[StdIdentifier, BlockFlavourIdentifier('affine:image')]
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user