exif: add null check for MIMEType

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/888/head
Varun Patil 2023-10-22 12:09:00 -07:00
parent 1ad0559436
commit d8f327141f
2 changed files with 6 additions and 1 deletions

View File

@ -91,6 +91,11 @@ class TimelineWrite
throw new \Exception('No EXIF data could be read: '.$file->getPath());
}
// Check if MIMEType was not detected
if (empty($exif['MIMEType'] ?? null)) {
throw new \Exception('No MIMEType in EXIF data: '.$file->getPath());
}
// Hand off if Live Photo video part
if ($isvideo && $this->livePhoto->isVideoPart($exif)) {
$this->livePhoto->processVideoPart($file, $exif);

View File

@ -149,7 +149,7 @@ class Exif
$exifDate = $exif['DateTimeOriginal'] ?? $exif['CreateDate'] ?? null;
// For videos, prefer CreateDate for timezone (QuickTimeUTC=1)
if (preg_match('/^video\/\w+/', (string) $exif['MIMEType'])) {
if (preg_match('/^video\/\w+/', (string) ($exif['MIMEType'] ?? null))) {
$exifDate = $exif['CreateDate'] ?? $exifDate;
}