diff --git a/lib/Album/AlbumMapper.php b/lib/Album/AlbumMapper.php index acc8f4b05..30d229e40 100644 --- a/lib/Album/AlbumMapper.php +++ b/lib/Album/AlbumMapper.php @@ -110,7 +110,7 @@ public function getForUser(string $userId): array { return new AlbumInfo((int)$row['album_id'], $userId, $row['name'], $row['location'], (int)$row['created'], (int)$row['last_added_photo']); }, $rows); } - + /** * @param string $albumName * @param string $userName @@ -220,10 +220,8 @@ public function getForAlbumIdAndUserWithFiles(int $albumId, string $userId): arr $files = []; foreach ($rows as $row) { - $albumId = (int)$row['album_id']; if ($row['fileid']) { - $mimeId = $row['mimetype']; - $mimeType = $this->mimeTypeLoader->getMimetypeById($mimeId); + $mimeType = $this->mimeTypeLoader->getMimetypeById((int)$row['mimetype']); $files[] = new AlbumFile((int)$row['fileid'], $row['file_name'], $mimeType, (int)$row['size'], (int)$row['mtime'], $row['etag'], (int)$row['added'], $row['owner']); } } @@ -248,8 +246,7 @@ public function getForAlbumIdAndFileId(int $albumId, int $fileId): AlbumFile { ->andWhere($query->expr()->eq('file_id', $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))); $row = $query->executeQuery()->fetchAll()[0]; - $mimeId = $row['mimetype']; - $mimeType = $this->mimeTypeLoader->getMimetypeById($mimeId); + $mimeType = $this->mimeTypeLoader->getMimetypeById((int)$row['mimetype']); return new AlbumFile((int)$row['fileid'], $row['file_name'], $mimeType, (int)$row['size'], (int)$row['mtime'], $row['etag'], (int)$row['added'], $row['owner']); } @@ -548,8 +545,7 @@ public function getSharedAlbumsForCollaboratorWithFiles(string $collaboratorId, foreach ($rows as $row) { $albumId = (int)$row['album_id']; if ($row['fileid']) { - $mimeId = $row['mimetype']; - $mimeType = $this->mimeTypeLoader->getMimetypeById($mimeId); + $mimeType = $this->mimeTypeLoader->getMimetypeById((int)$row['mimetype']); $filesByAlbum[$albumId][] = new AlbumFile((int)$row['fileid'], $row['file_name'], $mimeType, (int)$row['size'], (int)$row['mtime'], $row['etag'], (int)$row['added'], $row['owner']); }