limit max content size to 10MB

This commit is contained in:
Hongbo Wu
2023-10-23 21:11:37 +08:00
parent 0c60706503
commit e673db423b
2 changed files with 18 additions and 5 deletions

View File

@ -543,7 +543,8 @@ const schema = gql`
title: String!
byline: String
dir: String
content: String!
# max length of 10MB
content: String! @sanitize(maxLength: 10485760)
textContent: String!
length: Int!
excerpt: String!
@ -559,7 +560,8 @@ const schema = gql`
source: String!
clientRequestId: ID!
title: String
originalContent: String!
# max length of 10MB
originalContent: String! @sanitize(maxLength: 10485760)
parseResult: ParseResult
state: ArticleSavingRequestStatus
labels: [CreateLabelInput!]

View File

@ -431,7 +431,13 @@ export const updateLibraryItem = async (
await pubsub.entityUpdated<QueryDeepPartialEntity<LibraryItem>>(
EntityType.PAGE,
{ ...libraryItem, id },
{
...libraryItem,
id,
// don't send original content and readable content
originalContent: undefined,
readableContent: undefined,
},
userId
)
@ -535,9 +541,14 @@ export const createLibraryItem = async (
userId
)
await pubsub.entityCreated<LibraryItem>(
await pubsub.entityCreated<DeepPartial<LibraryItem>>(
EntityType.PAGE,
newLibraryItem,
{
...newLibraryItem,
// don't send original content and readable content
originalContent: undefined,
readableContent: undefined,
},
userId
)