Skip to content

Commit

Permalink
fix: Add missing validation to document state
Browse files Browse the repository at this point in the history
  • Loading branch information
tommoor committed Aug 16, 2022
1 parent 44a4aee commit cfa7ecd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/models/Document.ts
Expand Up @@ -228,6 +228,10 @@ class Document extends ParanoidModel {
@Column(DataType.TEXT)
text: string;

@Length({
max: DocumentValidation.maxStateLength,
msg: `Document collaborative state is too large, you must create a new document`,
})
@Column(DataType.BLOB)
state: Uint8Array;

Expand Down
3 changes: 3 additions & 0 deletions shared/validations.ts
Expand Up @@ -30,6 +30,9 @@ export const CollectionValidation = {
export const DocumentValidation = {
/** The maximum length of the document title */
maxTitleLength: 100,

/** The maximum size of the collaborative document state */
maxStateLength: 1000000,
};

export const PinValidation = {
Expand Down

0 comments on commit cfa7ecd

Please sign in to comment.