diff options
author | Olivier Paroz <github@oparoz.com> | 2015-09-18 00:48:23 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-09-18 00:48:23 +0300 |
commit | c10584a838a75f2de882b62d8834dce96da3ff69 (patch) | |
tree | c889f9241789184e9da2a7bb0fa69a1a0ab26e3c /controller | |
parent | ec6a904c8df91a614c435d48568970edc1c3c2a8 (diff) |
Don't use the session in the API or in downloads
Diffstat (limited to 'controller')
-rw-r--r-- | controller/filesapicontroller.php | 9 | ||||
-rw-r--r-- | controller/filescontroller.php | 8 | ||||
-rw-r--r-- | controller/filespubliccontroller.php | 1 |
3 files changed, 12 insertions, 6 deletions
diff --git a/controller/filesapicontroller.php b/controller/filesapicontroller.php index a59e7029..ce5ad063 100644 --- a/controller/filesapicontroller.php +++ b/controller/filesapicontroller.php @@ -19,6 +19,7 @@ use OCP\ILogger; use OCP\AppFramework\ApiController; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\RedirectResponse; use OCA\Gallery\Http\ImageResponse; use OCA\Gallery\Service\SearchFolderService; @@ -107,7 +108,6 @@ class FilesApiController extends ApiController { * @NoAdminRequired * @NoCSRFRequired * @CORS - * @UseSession * * Sends the file matching the fileId * @@ -124,9 +124,12 @@ class FilesApiController extends ApiController { try { $download = $this->getDownload($fileId, $filename); } catch (ServiceException $exception) { - return $this->htmlError( - $this->session, $this->urlGenerator, $this->appName, $exception + $code = $this->getHttpStatusCode($exception); + $url = $this->urlGenerator->linkToRoute( + $this->appName . '.page.error_page', ['code' => $code] ); + + return new RedirectResponse($url); } return new ImageResponse($download); diff --git a/controller/filescontroller.php b/controller/filescontroller.php index 1370bb95..a880766a 100644 --- a/controller/filescontroller.php +++ b/controller/filescontroller.php @@ -19,6 +19,7 @@ use OCP\ILogger; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\RedirectResponse; use OCA\Gallery\Http\ImageResponse; use OCA\Gallery\Service\SearchFolderService; @@ -120,9 +121,12 @@ class FilesController extends Controller { try { $download = $this->getDownload($fileId, $filename); } catch (ServiceException $exception) { - return $this->htmlError( - $this->session, $this->urlGenerator, $this->appName, $exception + $code = $this->getHttpStatusCode($exception); + $url = $this->urlGenerator->linkToRoute( + $this->appName . '.page.error_page', ['code' => $code] ); + + return new RedirectResponse($url); } return new ImageResponse($download); diff --git a/controller/filespubliccontroller.php b/controller/filespubliccontroller.php index 32380b48..90c06a1a 100644 --- a/controller/filespubliccontroller.php +++ b/controller/filespubliccontroller.php @@ -41,7 +41,6 @@ class FilesPublicController extends FilesController { /** * @PublicPage * @NoCSRFRequired - * @UseSession * * Sends the file matching the fileId * |