]> source.dussan.org Git - nextcloud-server.git/commitdiff
Handle more error cases
authorMorris Jobke <hey@morrisjobke.de>
Mon, 1 May 2017 21:41:37 +0000 (18:41 -0300)
committerRobin Appelman <robin@icewind.nl>
Tue, 2 May 2017 11:43:48 +0000 (13:43 +0200)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
apps/files_sharing/lib/Controller/PublicPreviewController.php
apps/files_trashbin/lib/Controller/PreviewController.php
apps/files_versions/lib/Controller/PreviewController.php
core/Controller/PreviewController.php

index b91b84c9c3498c51520b512518c1481e3b47234a..49e48993f5cc6539e9a38e8f6823b532a49aef37 100644 (file)
@@ -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);
                }
        }
 }
index c73b1c17c16c2006c7c83237abd79776fc458618..ae3a106d627e99ccf1d2d547a7c7bfad9f472b6a 100644 (file)
@@ -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);
                }
        }
 }
index 8d961f47ee68c58529630d9fb42ecec12df7ab12..7a7c024fb522aa0995bc9eb52e56611dc9d0e316 100644 (file)
@@ -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);
                }
        }
 }
index 4b9ba8b60d49f58caee6910d7e72c861538c3378..4e2b2f0287a83f2efe375ae0414af9d29b069889 100644 (file)
@@ -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);
                }
 
        }