summaryrefslogtreecommitdiffstats
path: root/apps/files/ajax
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-02-04 15:58:16 +0100
committerLukas Reschke <lukas@owncloud.com>2015-02-04 15:58:16 +0100
commitcc80ce70b41d938ba5df512509a589804417a9d7 (patch)
tree642f38a4cce2a42f14310cd8a7352d14332df693 /apps/files/ajax
parent486f49ed72970276462f09074829576588352b2a (diff)
downloadnextcloud-server-cc80ce70b41d938ba5df512509a589804417a9d7.tar.gz
nextcloud-server-cc80ce70b41d938ba5df512509a589804417a9d7.zip
Catch exception properly
`\OCA\Files\Helper::buildFileStorageStatistics` might throw an exception from `OC_Helper::getStorageInfo`, previously this lead to a uncatched exception being thrown when invoking this methods. This was user triggable by for example calling `/index.php/apps/files/ajax/delete.php` with a not existing dir (for example `dir=asdf/../&allfiles=true`)
Diffstat (limited to 'apps/files/ajax')
-rw-r--r--apps/files/ajax/delete.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php
index 61caa7618da..1a810f6954c 100644
--- a/apps/files/ajax/delete.php
+++ b/apps/files/ajax/delete.php
@@ -36,7 +36,12 @@ foreach ($files as $file) {
}
// get array with updated storage stats (e.g. max file size) after upload
-$storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir);
+try {
+ $storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir);
+} catch(\OCP\Files\NotFoundException $e) {
+ OCP\JSON::error(['data' => ['message' => 'File not found']]);
+ return;
+}
if ($success) {
OCP\JSON::success(array("data" => array_merge(array("dir" => $dir, "files" => $files), $storageStats)));