diff options
author | Richard Steinmetz <richard@steinmetz.cloud> | 2024-01-15 09:12:49 +0100 |
---|---|---|
committer | Richard Steinmetz <richard@steinmetz.cloud> | 2024-01-15 11:21:22 +0100 |
commit | 94d7e459bcdf541ec479328cf15363d4dede57eb (patch) | |
tree | df8e8a727c7734f1ae07ae556d45d6c86a60fed8 | |
parent | baf49e395031dfa9a271998f1cf3c1a1e1029dfc (diff) | |
download | nextcloud-server-94d7e459bcdf541ec479328cf15363d4dede57eb.tar.gz nextcloud-server-94d7e459bcdf541ec479328cf15363d4dede57eb.zip |
fix: handle exif metadata read errors gracefully
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
-rw-r--r-- | lib/private/Metadata/Provider/ExifProvider.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/private/Metadata/Provider/ExifProvider.php b/lib/private/Metadata/Provider/ExifProvider.php index b1598abbbc8..b00e811c960 100644 --- a/lib/private/Metadata/Provider/ExifProvider.php +++ b/lib/private/Metadata/Provider/ExifProvider.php @@ -71,8 +71,9 @@ class ExifProvider implements IMetadataProvider { $size->setId($file->getId()); $size->setArrayAsValue([]); - if (!$data) { - $sizeResult = getimagesizefromstring($file->getContent()); + $content = $file->getContent(); + if (!$data && $content) { + $sizeResult = getimagesizefromstring($content); if ($sizeResult !== false) { $size->setArrayAsValue([ 'width' => $sizeResult[0], @@ -81,7 +82,7 @@ class ExifProvider implements IMetadataProvider { $exifData['size'] = $size; } - } elseif (array_key_exists('COMPUTED', $data)) { + } elseif ($data && array_key_exists('COMPUTED', $data)) { if (array_key_exists('Width', $data['COMPUTED']) && array_key_exists('Height', $data['COMPUTED'])) { $size->setArrayAsValue([ 'width' => $data['COMPUTED']['Width'], |