Check media_attributes keys before using them in Mastodon\Statuses
- Address https://github.com/friendica/friendica/issues/13157#issuecomment-1832575517
This commit is contained in:
parent
05ffc8b0d7
commit
6c7dee4bcd
1 changed files with 4 additions and 4 deletions
|
@ -122,8 +122,8 @@ class Statuses extends BaseApi
|
|||
$existing_media = array_column(Post\Media::getByURIId($post['uri-id'], [Post\Media::AUDIO, Post\Media::VIDEO, Post\Media::IMAGE]), 'id');
|
||||
|
||||
foreach ($request['media_attributes'] as $attributes) {
|
||||
if (in_array($attributes['id'], $existing_media)) {
|
||||
Post\Media::updateById(['description' => $attributes['description']], $attributes['id']);
|
||||
if (!empty($attributes['id']) && in_array($attributes['id'], $existing_media)) {
|
||||
Post\Media::updateById(['description' => $attributes['description'] ?? null], $attributes['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue