Skip to content

Commit 400524a

Browse files
authored
Merge pull request #42774 from nextcloud/fix/exif-content-provider-stable27
[stable27] fix: handle exif metadata read errors gracefully
2 parents 591992d + 94d7e45 commit 400524a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/private/Metadata/Provider/ExifProvider.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ public function execute(File $file): array {
7171
$size->setId($file->getId());
7272
$size->setArrayAsValue([]);
7373

74-
if (!$data) {
75-
$sizeResult = getimagesizefromstring($file->getContent());
74+
$content = $file->getContent();
75+
if (!$data && $content) {
76+
$sizeResult = getimagesizefromstring($content);
7677
if ($sizeResult !== false) {
7778
$size->setArrayAsValue([
7879
'width' => $sizeResult[0],
@@ -81,7 +82,7 @@ public function execute(File $file): array {
8182

8283
$exifData['size'] = $size;
8384
}
84-
} elseif (array_key_exists('COMPUTED', $data)) {
85+
} elseif ($data && array_key_exists('COMPUTED', $data)) {
8586
if (array_key_exists('Width', $data['COMPUTED']) && array_key_exists('Height', $data['COMPUTED'])) {
8687
$size->setArrayAsValue([
8788
'width' => $data['COMPUTED']['Width'],

0 commit comments

Comments
 (0)