[Pkg-owncloud-commits] [owncloud] 171/273: More error catching in list.php
David Prévot
taffit at moszumanska.debian.org
Fri Jul 4 03:13:13 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 8339618ead32bf21e76d65d0e0015cf0cd8adc1f
Author: Robin Appelman <icewind at owncloud.com>
Date: Tue Jul 1 14:58:17 2014 +0200
More error catching in list.php
---
apps/files/ajax/list.php | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php
index b94d00e..b464134 100644
--- a/apps/files/ajax/list.php
+++ b/apps/files/ajax/list.php
@@ -1,12 +1,14 @@
<?php
-try {
- OCP\JSON::checkLoggedIn();
- \OC::$session->close();
+OCP\JSON::checkLoggedIn();
+\OC::$session->close();
+$l = OC_L10N::get('files');
+
+// Load the files
+$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
+$dir = \OC\Files\Filesystem::normalizePath($dir);
- // Load the files
- $dir = isset($_GET['dir']) ? $_GET['dir'] : '';
- $dir = \OC\Files\Filesystem::normalizePath($dir);
+try {
$dirInfo = \OC\Files\Filesystem::getFileInfo($dir);
if (!$dirInfo || !$dirInfo->getType() === 'dir') {
header("HTTP/1.0 404 Not Found");
@@ -30,11 +32,24 @@ try {
OCP\JSON::success(array('data' => $data));
} catch (\OCP\Files\StorageNotAvailableException $e) {
- $l = OC_L10N::get('files');
OCP\JSON::error(array(
'data' => array(
'exception' => '\OCP\Files\StorageNotAvailableException',
'message' => $l->t('Storage not available')
)
));
+} catch (\OCP\Files\StorageInvalidException $e) {
+ OCP\JSON::error(array(
+ 'data' => array(
+ 'exception' => '\OCP\Files\StorageInvalidException',
+ 'message' => $l->t('Storage invalid')
+ )
+ ));
+} catch (\Exception $e) {
+ OCP\JSON::error(array(
+ 'data' => array(
+ 'exception' => '\Exception',
+ 'message' => $l->t('Unknown error')
+ )
+ ));
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list