fix error message for folder preview request

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2018-10-08 16:42:22 +02:00
parent 6c5ea0ceca
commit f5a41e2e15
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 4 additions and 4 deletions

View File

@ -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'];