Improved mimeType detection and setting of the "type" field

This commit is contained in:
Michael 2021-04-14 19:12:01 +00:00
parent 0b239f368b
commit b65f73e348
3 changed files with 104 additions and 38 deletions

View file

@ -2684,7 +2684,12 @@ class Item
{
$leading = '';
$trailing = '';
foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) {
foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::AUDIO, Post\Media::VIDEO,
Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) {
if (in_array($attachment['type'], [Post\Media::AUDIO, Post\Media::VIDEO]) && strpos($item['body'], $attachment['url'])) {
continue;
}
$mime = $attachment['mimetype'];
$author = ['uid' => 0, 'id' => $item['author-id'],