diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-08-19 08:15:30 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-08-19 08:15:30 +0200 |
commit | 54f79a28f6650ec5cb4fbd9e152eb1d6fb0aa0cb (patch) | |
tree | 3352eade07a333b63646f486eb771b223e2d3859 /apps/files/lib/Controller | |
parent | a83c5e8b005209adf349636b2175fdb46bbc2d66 (diff) | |
download | nextcloud-server-54f79a28f6650ec5cb4fbd9e152eb1d6fb0aa0cb.tar.gz nextcloud-server-54f79a28f6650ec5cb4fbd9e152eb1d6fb0aa0cb.zip |
When using permalinks don't error out if file id can't be found
Fixes #952
* Use only the index route (since it went to showFile anyways)
* Fix tests
* Use getUserFolder to force init of users mounts
Diffstat (limited to 'apps/files/lib/Controller')
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 779a2c7aadc..9d26c048368 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -27,11 +27,11 @@ namespace OCA\Files\Controller; -use OC\AppFramework\Http\Request; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\TemplateResponse; +use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\IConfig; use OCP\IL10N; @@ -67,7 +67,7 @@ class ViewController extends Controller { protected $userSession; /** @var IAppManager */ protected $appManager; - /** @var \OCP\Files\Folder */ + /** @var IRootFolder */ protected $rootFolder; /** @@ -80,7 +80,7 @@ class ViewController extends Controller { * @param EventDispatcherInterface $eventDispatcherInterface * @param IUserSession $userSession * @param IAppManager $appManager - * @param Folder $rootFolder + * @param IRootFolder $rootFolder */ public function __construct($appName, IRequest $request, @@ -91,7 +91,7 @@ class ViewController extends Controller { EventDispatcherInterface $eventDispatcherInterface, IUserSession $userSession, IAppManager $appManager, - Folder $rootFolder + IRootFolder $rootFolder ) { parent::__construct($appName, $request); $this->appName = $appName; @@ -267,13 +267,10 @@ class ViewController extends Controller { * @param string $fileId file id to show * @return RedirectResponse redirect response or not found response * @throws \OCP\Files\NotFoundException - * - * @NoCSRFRequired - * @NoAdminRequired */ - public function showFile($fileId) { + private function showFile($fileId) { $uid = $this->userSession->getUser()->getUID(); - $baseFolder = $this->rootFolder->get($uid . '/files/'); + $baseFolder = $this->rootFolder->getUserFolder($uid); $files = $baseFolder->getById($fileId); $params = []; |