diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-10-18 10:36:57 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-11-03 14:00:33 +0100 |
commit | 55af6b45f72e0717d7b6f07b69bc0f12f4fb4cd9 (patch) | |
tree | 94990fdc1391dc5e2f558522bbbac377daa2fd3e /apps/files_versions/lib | |
parent | 87855aa97b0d90f8036ec40174ac1a3dcbd463e8 (diff) | |
download | nextcloud-server-55af6b45f72e0717d7b6f07b69bc0f12f4fb4cd9.tar.gz nextcloud-server-55af6b45f72e0717d7b6f07b69bc0f12f4fb4cd9.zip |
More tests
* PreviewController test
* PublicPreview test
* Versions Preview test
* Trash Preview test
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_versions/lib')
-rw-r--r-- | apps/files_versions/lib/Controller/PreviewController.php | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/apps/files_versions/lib/Controller/PreviewController.php b/apps/files_versions/lib/Controller/PreviewController.php index 3225febfcff..8d961f47ee6 100644 --- a/apps/files_versions/lib/Controller/PreviewController.php +++ b/apps/files_versions/lib/Controller/PreviewController.php @@ -78,11 +78,7 @@ class PreviewController extends Controller { $y = 44, $version = '' ) { - if($file === '' && $version === '') { - return new DataResponse([], Http::STATUS_BAD_REQUEST); - } - - if($x === 0 || $y === 0) { + if($file === '' || $version === '' || $x === 0 || $y === 0) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -93,19 +89,11 @@ class PreviewController extends Controller { $mimeType = $this->mimeTypeDetector->detectPath($file); $file = $versionFolder->get($file.'.v'.$version); - if ($file instanceof Folder) { - return new DataResponse([], Http::STATUS_BAD_REQUEST); - } - /** @var File $file */ $f = $this->previewManager->getPreview($file, $x, $y, true, IPreview::MODE_FILL, $mimeType); - return new FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]); } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); - } catch (\Exception $e) { - return new DataResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); } - } } |