if (!$info instanceof OCP\Files\FileInfo || !$always && !\OC::$server->getPreviewManager()->isAvailable($info)) {
\OC_Response::setStatus(404);
+} else if (!$info->isReadable()) {
+ \OC_Response::setStatus(403);
} else {
$preview = new \OC\Preview(\OC_User::getUser(), 'files');
$preview->setFile($file, $info);
$this->preview = null;
$fileInfo = $this->getFileInfo();
- if ($fileInfo === null || $fileInfo === false) {
+ if ($fileInfo === null || $fileInfo === false || !$fileInfo->isReadable()) {
return new \OC_Image();
}