summaryrefslogtreecommitdiffstats
path: root/apps/files/ajax/newfolder.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/ajax/newfolder.php')
-rw-r--r--apps/files/ajax/newfolder.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/apps/files/ajax/newfolder.php b/apps/files/ajax/newfolder.php
index 90bc9ecbb83..b15457e0173 100644
--- a/apps/files/ajax/newfolder.php
+++ b/apps/files/ajax/newfolder.php
@@ -74,15 +74,26 @@ if (\OC\Files\Filesystem::file_exists($target)) {
exit();
}
-if(\OC\Files\Filesystem::mkdir($target)) {
- if ( $dir !== '/') {
- $path = $dir.'/'.$folderName;
- } else {
- $path = '/'.$folderName;
+try {
+ if(\OC\Files\Filesystem::mkdir($target)) {
+ if ( $dir !== '/') {
+ $path = $dir.'/'.$folderName;
+ } else {
+ $path = '/'.$folderName;
+ }
+ $meta = \OC\Files\Filesystem::getFileInfo($path);
+ $meta['type'] = 'dir'; // missing ?!
+ OCP\JSON::success(array('data' => \OCA\Files\Helper::formatFileInfo($meta)));
+ exit();
}
- $meta = \OC\Files\Filesystem::getFileInfo($path);
- $meta['type'] = 'dir'; // missing ?!
- OCP\JSON::success(array('data' => \OCA\Files\Helper::formatFileInfo($meta)));
+} catch (\Exception $e) {
+ $result = [
+ 'success' => false,
+ 'data' => [
+ 'message' => $e->getMessage()
+ ]
+ ];
+ OCP\JSON::error($result);
exit();
}