\OC::$server->getSession()->close();
// send back json
-OCP\JSON::success(array('data' => \OCA\Files\Helper::buildFileStorageStatistics($dir)));
+try {
+ OCP\JSON::success(array('data' => \OCA\Files\Helper::buildFileStorageStatistics($dir)));
+} catch (\OCP\Files\NotFoundException $e) {
+ OCP\JSON::error(['data' => ['message' => 'Folder not found']]);
+}
if (!$rootInfo) {
$rootInfo = \OC\Files\Filesystem::getFileInfo($path, false);
}
+ if (!$rootInfo instanceof \OCP\Files\FileInfo) {
+ throw new \OCP\Files\NotFoundException();
+ }
$used = $rootInfo->getSize();
if ($used < 0) {
$used = 0;