From f5a41e2e15dc0b1a245dccd569a5123ec87e2a1e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 8 Oct 2018 16:42:22 +0200 Subject: [PATCH] fix error message for folder preview request Signed-off-by: Robin Appelman --- apps/files_trashbin/lib/Controller/PreviewController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/files_trashbin/lib/Controller/PreviewController.php b/apps/files_trashbin/lib/Controller/PreviewController.php index 59c4e50815..f79e19a463 100644 --- a/apps/files_trashbin/lib/Controller/PreviewController.php +++ b/apps/files_trashbin/lib/Controller/PreviewController.php @@ -30,15 +30,12 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\Files\File; -use OCP\Files\FileInfo; use OCP\Files\Folder; use OCP\Files\IMimeTypeDetector; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\IPreview; use OCP\IRequest; -use OCP\IUser; use OCP\IUserSession; class PreviewController extends Controller { @@ -98,9 +95,12 @@ class PreviewController extends Controller { try { $file = $this->trashManager->getTrashNodeById($this->userSession->getUser(), $fileId); - if ($file === null || $file instanceof Folder) { + if ($file === null) { return new DataResponse([], Http::STATUS_NOT_FOUND); } + if ($file instanceof Folder) { + return new DataResponse([], Http::STATUS_BAD_REQUEST); + } $pathParts = pathinfo($file->getName()); $extension = $pathParts['extension'];