(core) lock down modification of the _grist_Attachments table

Summary:
Rows in the _grist_Attachments table have a special lifecycle,
being created by a special method, and deleted via a special
process. All other modifications are now rejected, for simplicity.

Test Plan: added test

Reviewers: dsagal, jarek

Reviewed By: dsagal, jarek

Differential Revision: https://phab.getgrist.com/D3712
This commit is contained in:
Paul Fitzpatrick
2022-11-22 09:15:18 -05:00
parent 94a7b750a8
commit 312d2331a8
4 changed files with 27 additions and 4 deletions

View File

@@ -844,7 +844,9 @@ export class ActiveDoc extends EventEmitter {
);
const userActions: UserAction[] = await Promise.all(
upload.files.map(file => this._prepAttachment(docSession, file)));
const result = await this.applyUserActions(docSession, userActions);
const result = await this._applyUserActionsWithExtendedOptions(docSession, userActions, {
attachment: true,
});
this._updateAttachmentsSize().catch(e => {
this._log.warn(docSession, 'failed to update attachments size', e);
});