From 2e9b482de8e34ec307647faa8a6a2a0c5ca5a463 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 28 Aug 2024 12:08:36 +0000 Subject: [PATCH] Fix exception "($shorthand) must be of type string, null given," --- src/Module/Api/Mastodon/Instance.php | 4 ++-- src/Module/Api/Mastodon/InstanceV2.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Module/Api/Mastodon/Instance.php b/src/Module/Api/Mastodon/Instance.php index 9da76fa256..6b7ddfb3e1 100644 --- a/src/Module/Api/Mastodon/Instance.php +++ b/src/Module/Api/Mastodon/Instance.php @@ -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')); } diff --git a/src/Module/Api/Mastodon/InstanceV2.php b/src/Module/Api/Mastodon/InstanceV2.php index 226fec8207..f33f60b2c6 100644 --- a/src/Module/Api/Mastodon/InstanceV2.php +++ b/src/Module/Api/Mastodon/InstanceV2.php @@ -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')); }