From 85154fff693c80374bc048ca9497df663bd5e32d Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 14 Nov 2021 22:03:22 +0000 Subject: [PATCH] Added an env configurable file upload size limit Replaces the old suggestion of setting JS head 'window.uploadLimit' variable. This new env option will be used by back-end validation and front-end libs/logic too. Limits already likely exist within prod environments at a PHP and webserver level but this allows an app-level limit and centralises the option on the BookStack side into the .env Closes #3033 --- .env.example.complete | 4 ++ app/Config/app.php | 3 ++ app/Entities/Tools/PageContent.php | 6 +++ app/Http/Controllers/Api/ApiController.php | 5 +++ .../Api/AttachmentApiController.php | 37 ++++++++++--------- app/Http/Controllers/AttachmentController.php | 5 ++- app/Http/Controllers/Controller.php | 4 +- app/Uploads/AttachmentService.php | 8 ++++ resources/js/components/dropzone.js | 3 +- resources/views/form/dropzone.blade.php | 1 + 10 files changed, 54 insertions(+), 22 deletions(-) diff --git a/.env.example.complete b/.env.example.complete index 683db703c..9a46b23a5 100644 --- a/.env.example.complete +++ b/.env.example.complete @@ -293,6 +293,10 @@ REVISION_LIMIT=50 # Set to -1 for unlimited recycle bin lifetime. RECYCLE_BIN_LIFETIME=30 +# File Upload Limit +# Maximum file size, in megabytes, that can be uploaded to the system. +FILE_UPLOAD_SIZE_LIMIT=50 + # Allow