]> git.mxchange.org Git - friendica.git/commitdiff
Fix exception "($shorthand) must be of type string, null given,"
authorMichael <heluecht@pirati.ca>
Wed, 28 Aug 2024 12:08:36 +0000 (12:08 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 28 Aug 2024 12:08:36 +0000 (12:08 +0000)
src/Module/Api/Mastodon/Instance.php
src/Module/Api/Mastodon/InstanceV2.php

index 9da76fa256319aee4c7e0bd382a978493e01c0e9..6b7ddfb3e142c09b0a4245b28c7633170ae6f72f 100644 (file)
@@ -71,7 +71,7 @@ class Instance extends BaseApi
                        $this->config->get('config', 'max_import_size')
                ), 99, 23);
 
-               $image_size_limit = Strings::getBytesFromShorthand($this->config->get('system', 'maximagesize'));
+               $image_size_limit = Strings::getBytesFromShorthand($this->config->get('system', 'maximagesize') ?? 0);
                $max_image_length = $this->config->get('system', 'max_image_length');
                if ($max_image_length > 0) {
                        $image_matrix_limit = pow($max_image_length, 2);
@@ -79,7 +79,7 @@ class Instance extends BaseApi
                        $image_matrix_limit = 33177600; // 5760^2
                }
 
-               $media_size_limit = Strings::getBytesFromShorthand($this->config->get('system', 'maxfilesize'));
+               $media_size_limit = Strings::getBytesFromShorthand($this->config->get('system', 'maxfilesize') ?? 0);
                if (empty($media_size_limit)) {
                        $media_size_limit = Strings::getBytesFromShorthand(ini_get('upload_max_filesize'));
                }
index 226fec82071128b5e7998cbbae8bf996880703d1..f33f60b2c61ecdcd88b55702f515660be137352c 100644 (file)
@@ -107,7 +107,7 @@ class InstanceV2 extends BaseApi
                        $this->config->get('config', 'max_import_size')
                ), 99, 23);
 
-               $image_size_limit = Strings::getBytesFromShorthand($this->config->get('system', 'maximagesize'));
+               $image_size_limit = Strings::getBytesFromShorthand($this->config->get('system', 'maximagesize') ?? 0);
                $max_image_length = $this->config->get('system', 'max_image_length');
                if ($max_image_length > 0) {
                        $image_matrix_limit = pow($max_image_length, 2);
@@ -115,7 +115,7 @@ class InstanceV2 extends BaseApi
                        $image_matrix_limit = 33177600; // 5760^2
                }
 
-               $media_size_limit = Strings::getBytesFromShorthand($this->config->get('system', 'maxfilesize'));
+               $media_size_limit = Strings::getBytesFromShorthand($this->config->get('system', 'maxfilesize') ?? 0);
                if (empty($media_size_limit)) {
                        $media_size_limit = Strings::getBytesFromShorthand(ini_get('upload_max_filesize'));
                }