This commit is contained in:
Michael 2021-07-03 15:47:11 +00:00
parent c72abe48a8
commit f37e808e02

View File

@ -229,7 +229,7 @@ class Media
*/ */
private static function fetchLocalData(array $media) private static function fetchLocalData(array $media)
{ {
if (!preg_match('|.*?/photo/(.*[a-fA-F0-9])\-(.*[0-9])\..*[\w]|', $media['url'], $matches)) { if (!preg_match('|.*?/photo/(.*[a-fA-F0-9])\-(.*[0-9])\..*[\w]|', $media['url'] ?? '', $matches)) {
return $media; return $media;
} }
$photo = Photo::selectFirst([], ['resource-id' => $matches[1], 'scale' => $matches[2]]); $photo = Photo::selectFirst([], ['resource-id' => $matches[1], 'scale' => $matches[2]]);
@ -240,7 +240,7 @@ class Media
$media['height'] = $photo['height']; $media['height'] = $photo['height'];
} }
if (!preg_match('|.*?/photo/(.*[a-fA-F0-9])\-(.*[0-9])\..*[\w]|', $media['preview'], $matches)) { if (!preg_match('|.*?/photo/(.*[a-fA-F0-9])\-(.*[0-9])\..*[\w]|', $media['preview'] ?? '', $matches)) {
return $media; return $media;
} }
$photo = Photo::selectFirst([], ['resource-id' => $matches[1], 'scale' => $matches[2]]); $photo = Photo::selectFirst([], ['resource-id' => $matches[1], 'scale' => $matches[2]]);