Skip to content

Commit

Permalink
Handle permission denied error on listing folders (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkode authored Apr 10, 2017
1 parent ca43451 commit 9a67a2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions apps/files/ajax/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@
'message' => $l->t('Storage invalid')
)
));
} catch (\OCP\Files\NotPermittedException $e) {
\OCP\Util::logException('files', $e);
OCP\JSON::error(array(
'data' => array(
'exception' => '\OCP\Files\NotPermittedException',
'message' => $l->t('Permission denied accessing the resource or temporary storage error')
)
));
} catch (\Exception $e) {
\OCP\Util::logException('files', $e);
OCP\JSON::error(array(
Expand Down
3 changes: 2 additions & 1 deletion lib/private/files/objectstore/eosutil.php
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,8 @@ public static function getFolderContents($eosPath, $additionalParameterCallback
$files = array();
list($result, $errcode) = EosCmd::exec($getFolderContents);
if ($errcode !== 0) {
return $files;
// Safe bet: always throw permission denied if the call to eos fails.
throw new \OCP\Files\NotPermittedException("cannot list contents of eos folder");
}

// we need to obtain the tree size performing an 'ls' command and merging attributes
Expand Down

0 comments on commit 9a67a2e

Please sign in to comment.