Merge pull request #14404 from annando/error

Fix exception "($shorthand) must be of type string, null given,"
This commit is contained in:
Tobias Diekershoff 2024-08-28 19:13:04 +02:00 committed by GitHub
commit dc145bb440
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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') $this->config->get('config', 'max_import_size')
), 99, 23); ), 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'); $max_image_length = $this->config->get('system', 'max_image_length');
if ($max_image_length > 0) { if ($max_image_length > 0) {
$image_matrix_limit = pow($max_image_length, 2); $image_matrix_limit = pow($max_image_length, 2);
@ -79,7 +79,7 @@ class Instance extends BaseApi
$image_matrix_limit = 33177600; // 5760^2 $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)) { if (empty($media_size_limit)) {
$media_size_limit = Strings::getBytesFromShorthand(ini_get('upload_max_filesize')); $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') $this->config->get('config', 'max_import_size')
), 99, 23); ), 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'); $max_image_length = $this->config->get('system', 'max_image_length');
if ($max_image_length > 0) { if ($max_image_length > 0) {
$image_matrix_limit = pow($max_image_length, 2); $image_matrix_limit = pow($max_image_length, 2);
@ -115,7 +115,7 @@ class InstanceV2 extends BaseApi
$image_matrix_limit = 33177600; // 5760^2 $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)) { if (empty($media_size_limit)) {
$media_size_limit = Strings::getBytesFromShorthand(ini_get('upload_max_filesize')); $media_size_limit = Strings::getBytesFromShorthand(ini_get('upload_max_filesize'));
} }