From 23cc309606443003c3478d96452998b109ea9c09 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Mon, 1 May 2017 18:41:37 -0300 Subject: [PATCH] Handle more error cases Signed-off-by: Morris Jobke --- apps/files_sharing/lib/Controller/PublicPreviewController.php | 2 ++ apps/files_trashbin/lib/Controller/PreviewController.php | 2 ++ apps/files_versions/lib/Controller/PreviewController.php | 2 ++ core/Controller/PreviewController.php | 2 ++ 4 files changed, 8 insertions(+) diff --git a/apps/files_sharing/lib/Controller/PublicPreviewController.php b/apps/files_sharing/lib/Controller/PublicPreviewController.php index b91b84c9c3..49e48993f5 100644 --- a/apps/files_sharing/lib/Controller/PublicPreviewController.php +++ b/apps/files_sharing/lib/Controller/PublicPreviewController.php @@ -97,6 +97,8 @@ class PublicPreviewController extends Controller { return new FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]); } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); + } catch (\InvalidArgumentException $e) { + return new DataResponse([], Http::STATUS_BAD_REQUEST); } } } diff --git a/apps/files_trashbin/lib/Controller/PreviewController.php b/apps/files_trashbin/lib/Controller/PreviewController.php index c73b1c17c1..ae3a106d62 100644 --- a/apps/files_trashbin/lib/Controller/PreviewController.php +++ b/apps/files_trashbin/lib/Controller/PreviewController.php @@ -114,6 +114,8 @@ class PreviewController extends Controller { return new Http\FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]); } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); + } catch (\InvalidArgumentException $e) { + return new DataResponse([], Http::STATUS_BAD_REQUEST); } } } diff --git a/apps/files_versions/lib/Controller/PreviewController.php b/apps/files_versions/lib/Controller/PreviewController.php index 8d961f47ee..7a7c024fb5 100644 --- a/apps/files_versions/lib/Controller/PreviewController.php +++ b/apps/files_versions/lib/Controller/PreviewController.php @@ -94,6 +94,8 @@ class PreviewController extends Controller { return new FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]); } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); + } catch (\InvalidArgumentException $e) { + return new DataResponse([], Http::STATUS_BAD_REQUEST); } } } diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index 4b9ba8b60d..4e2b2f0287 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -126,6 +126,8 @@ class PreviewController extends Controller { return $response; } catch (NotFoundException $e) { return new DataResponse([], Http::STATUS_NOT_FOUND); + } catch (\InvalidArgumentException $e) { + return new DataResponse([], Http::STATUS_BAD_REQUEST); } }