From 2d648ed0eb301ed35db568071325bdc7e0428eb9 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 17 Jun 2015 15:06:50 +0200 Subject: [PATCH] Verify if path exists We need to verify if the specified path exists to gracefully prevent errors. --- apps/files_sharing/ajax/publicpreview.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/files_sharing/ajax/publicpreview.php b/apps/files_sharing/ajax/publicpreview.php index 7685cda9d71..fff1a60b24e 100644 --- a/apps/files_sharing/ajax/publicpreview.php +++ b/apps/files_sharing/ajax/publicpreview.php @@ -63,6 +63,11 @@ $view = new \OC\Files\View('/' . $userId . '/files'); $pathId = $linkedItem['file_source']; $path = $view->getPath($pathId); + +if($path === null) { + throw new \OCP\Files\NotFoundException(); +} + $pathInfo = $view->getFileInfo($path); $sharedFile = null;