Merge pull request #1184 from nextcloud/backport-1089-allow-to-prevent-previews

[stable10] Check if the file isReadable() before sending a (cached) preview
This commit is contained in:
Morris Jobke 2016-08-30 13:31:07 +02:00 committed by GitHub
commit 3d43680d6e
2 changed files with 3 additions and 1 deletions

View File

@ -53,6 +53,8 @@ $info = \OC\Files\Filesystem::getFileInfo($file);
if (!$info instanceof OCP\Files\FileInfo || !$always && !\OC::$server->getPreviewManager()->isAvailable($info)) { if (!$info instanceof OCP\Files\FileInfo || !$always && !\OC::$server->getPreviewManager()->isAvailable($info)) {
\OC_Response::setStatus(404); \OC_Response::setStatus(404);
} else if (!$info->isReadable()) {
\OC_Response::setStatus(403);
} else { } else {
$preview = new \OC\Preview(\OC_User::getUser(), 'files'); $preview = new \OC\Preview(\OC_User::getUser(), 'files');
$preview->setFile($file, $info); $preview->setFile($file, $info);

View File

@ -763,7 +763,7 @@ class Preview {
$this->preview = null; $this->preview = null;
$fileInfo = $this->getFileInfo(); $fileInfo = $this->getFileInfo();
if ($fileInfo === null || $fileInfo === false) { if ($fileInfo === null || $fileInfo === false || !$fileInfo->isReadable()) {
return new \OC_Image(); return new \OC_Image();
} }