mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-07 15:54:26 +02:00
Fix upload error handling for media
see https://github.com/friendica/friendica/pull/14475 refs #14475
This commit is contained in:
parent
77831aaf49
commit
3975491887
1 changed files with 6 additions and 5 deletions
|
@ -44,12 +44,13 @@ class Media extends BaseApi
|
|||
|
||||
if (in_array($type, [Post\Media::IMAGE, Post\Media::UNKNOWN, Post\Media::APPLICATION])) {
|
||||
$media = Photo::upload($uid, $request['file'], '', null, null, '', '', $request['description']);
|
||||
if (!empty($media)) {
|
||||
|
||||
if (empty($media)) {
|
||||
$this->logAndJsonError(500, $this->errorFactory->InternalError('Error while uploading media.'));
|
||||
}
|
||||
|
||||
$this->logger->info('Uploaded photo', ['media' => $media]);
|
||||
$this->jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id']));
|
||||
} elseif ($type == Post\Media::IMAGE) {
|
||||
$this->jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id']));
|
||||
}
|
||||
}
|
||||
|
||||
$tempFileName = $request['file']['tmp_name'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue