Fix exception "($shorthand) must be of type string, null given,"

This commit is contained in:
Michael 2024-08-28 12:08:36 +00:00
parent e676a3db15
commit 2e9b482de8
2 changed files with 4 additions and 4 deletions

View 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'));
}

View 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'));
}