From 61adea6a067931fca7657641f8b455a55e3a2848 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 5 Mar 2024 10:23:36 +0500 Subject: [PATCH] monographs: check monograph size on update --- Notesnook.API/Controllers/MonographsController.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Notesnook.API/Controllers/MonographsController.cs b/Notesnook.API/Controllers/MonographsController.cs index 372288f..06126bb 100644 --- a/Notesnook.API/Controllers/MonographsController.cs +++ b/Notesnook.API/Controllers/MonographsController.cs @@ -74,6 +74,9 @@ namespace Notesnook.API.Controllers { if (await Monographs.GetAsync(monograph.Id) == null) return NotFound(); + if (monograph.EncryptedContent?.Cipher.Length > MAX_DOC_SIZE || monograph.CompressedContent?.Length > MAX_DOC_SIZE) + return base.BadRequest("Monograph is too big. Max allowed size is 15mb."); + if (monograph.EncryptedContent == null) monograph.CompressedContent = monograph.Content.CompressBrotli(); else