aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/controllers
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-09-30 13:32:20 +0200
committerLukas Reschke <lukas@owncloud.com>2015-09-30 13:32:20 +0200
commit22e724e8292315f600b57a30716e26c1f1c04f66 (patch)
tree63661ee0d8a708f761a31848e68728c44b141741 /apps/files_sharing/lib/controllers
parent6d743ffac6ceb2b89447e7a7da6fdbefc4a6d06a (diff)
downloadnextcloud-server-22e724e8292315f600b57a30716e26c1f1c04f66.tar.gz
nextcloud-server-22e724e8292315f600b57a30716e26c1f1c04f66.zip
Only intercept exceptions of type "NotFoundException" instead of any Exception
The sharing backend may throw another exception for example when the activity app encounters a problem. Previously this just triggered a 404 error page and the exception got not logged at all. With this change such exceptions get not intercepted and regularly handled as exceptions so that we have meaningful log data. Also the user will be shown a window informing him that an error happened. Helps to debug cases such as https://github.com/owncloud/core/issues/19465
Diffstat (limited to 'apps/files_sharing/lib/controllers')
-rw-r--r--apps/files_sharing/lib/controllers/sharecontroller.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php
index ecf3ee853ee..28feb3110b4 100644
--- a/apps/files_sharing/lib/controllers/sharecontroller.php
+++ b/apps/files_sharing/lib/controllers/sharecontroller.php
@@ -46,6 +46,7 @@ use OCA\Files_Sharing\Helper;
use OCP\User;
use OCP\Util;
use OCA\Files_Sharing\Activity;
+use \OCP\Files\NotFoundException;
/**
* Class ShareController
@@ -148,6 +149,7 @@ class ShareController extends Controller {
* @param string $token
* @param string $path
* @return TemplateResponse|RedirectResponse
+ * @throws NotFoundException
*/
public function showShare($token, $path = '') {
\OC_User::setIncognitoMode(true);
@@ -171,7 +173,7 @@ class ShareController extends Controller {
$getPath = Filesystem::normalizePath($path);
$originalSharePath .= $path;
} else {
- throw new OCP\Files\NotFoundException();
+ throw new NotFoundException();
}
$file = basename($originalSharePath);
@@ -303,7 +305,7 @@ class ShareController extends Controller {
/**
* @param string $token
* @return string Resolved file path of the token
- * @throws \Exception In case share could not get properly resolved
+ * @throws NotFoundException In case share could not get properly resolved
*/
private function getPath($token) {
$linkItem = Share::getShareByToken($token, false);
@@ -312,7 +314,7 @@ class ShareController extends Controller {
$rootLinkItem = Share::resolveReShare($linkItem);
if (isset($rootLinkItem['uid_owner'])) {
if(!$this->userManager->userExists($rootLinkItem['uid_owner'])) {
- throw new \Exception('Owner of the share does not exist anymore');
+ throw new NotFoundException('Owner of the share does not exist anymore');
}
OC_Util::tearDownFS();
OC_Util::setupFS($rootLinkItem['uid_owner']);
@@ -324,6 +326,6 @@ class ShareController extends Controller {
}
}
- throw new \Exception('No file found belonging to file.');
+ throw new NotFoundException('No file found belonging to file.');
}
}