fix error message for folder preview request
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
6c5ea0ceca
commit
f5a41e2e15
1 changed files with 4 additions and 4 deletions
|
@ -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'];
|
||||
|
|
Loading…
Reference in a new issue