/** * @param string $mimeType * @return string */ protected function getPreviewPathFromMimeType($mimeType) { $mimeTypeIcon = $this->mimeTypeDetector->mimeTypeIcon($mimeType); if (substr($mimeTypeIcon, -4) === '.png') { $mimeTypeIcon = substr($mimeTypeIcon, 0, -4) . '.svg'; } return $mimeTypeIcon; }
/** * @param string $messageId * @param $accountId * @param $folderId * @return callable */ private function enrichDownloadUrl($accountId, $folderId, $messageId, $attachment) { $downloadUrl = \OCP\Util::linkToRoute('mail.messages.downloadAttachment', ['accountId' => $accountId, 'folderId' => $folderId, 'messageId' => $messageId, 'attachmentId' => $attachment['id']]); $downloadUrl = \OC::$server->getURLGenerator()->getAbsoluteURL($downloadUrl); $attachment['downloadUrl'] = $downloadUrl; $attachment['mimeUrl'] = $this->mimeTypeDetector->mimeTypeIcon($attachment['mime']); if ($this->attachmentIsImage($attachment)) { $attachment['isImage'] = true; } return $attachment; }