Merge pull request #1089 from nextcloud/allow-to-prevent-previews
Check if the file isReadable() before sending a (cached) preview
This commit is contained in:
commit
83490e90ef
|
@ -53,6 +53,8 @@ $info = \OC\Files\Filesystem::getFileInfo($file);
|
|||
|
||||
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);
|
||||
|
|
|
@ -763,7 +763,7 @@ class Preview {
|
|||
|
||||
$this->preview = null;
|
||||
$fileInfo = $this->getFileInfo();
|
||||
if ($fileInfo === null || $fileInfo === false) {
|
||||
if ($fileInfo === null || $fileInfo === false || !$fileInfo->isReadable()) {
|
||||
return new \OC_Image();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue