From d3d018020884b2021342aebbfd794ee8f6ac6697 Mon Sep 17 00:00:00 2001 From: djmaze Date: Mon, 19 Jul 2021 14:27:25 +0200 Subject: [PATCH] Bugfix: default attachment_size_limit to PHP upload_max_filesize --- .../app/libraries/RainLoop/Config/Application.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php index 8858d1433..8afc3ec3a 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -106,6 +106,15 @@ class Application extends \RainLoop\Config\AbstractConfig protected function defaultValues() : array { + $value = \ini_get('upload_max_filesize'); + $upload_max_filesize = \intval($value); + switch (\strtoupper(\substr($value, -1))) { + case 'G': $upload_max_filesize *= 1024; + case 'M': $upload_max_filesize *= 1024; + case 'K': $upload_max_filesize *= 1024; + } + $upload_max_filesize = $upload_max_filesize / 1024 / 1024; + return array( 'webmail' => array( @@ -127,7 +136,7 @@ class Application extends \RainLoop\Config\AbstractConfig 'messages_per_page' => array(20, 'Number of messages displayed on page by default'), - 'attachment_size_limit' => array(25, 'File size limit (MB) for file upload on compose screen + 'attachment_size_limit' => array(\min($upload_max_filesize, 25), 'File size limit (MB) for file upload on compose screen 0 for unlimited.') ),