summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-06-22 10:21:00 +0200
committerGitHub <noreply@github.com>2016-06-22 10:21:00 +0200
commitc49ff83f18dba22f4a2e04a4df3d1e6a6623a0f7 (patch)
treeebc461ea75ff29bca0aae30d4a309a07c969b55b
parentb85bcccc09746137dd6fed78629b5bce45cebe01 (diff)
parentc8b7a059b4b8ae9a72d7be36f7e42fefbb130d35 (diff)
downloadnextcloud-server-c49ff83f18dba22f4a2e04a4df3d1e6a6623a0f7.tar.gz
nextcloud-server-c49ff83f18dba22f4a2e04a4df3d1e6a6623a0f7.zip
Merge pull request #25208 from owncloud/uploadfolder-firemkdirhooksforparents
Fire hooks for mkdir for folder upload
-rw-r--r--lib/private/Files/View.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index e9daa123470..31549c93cb2 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -998,7 +998,10 @@ class View {
// Create the directories if any
if (!$this->file_exists($filePath)) {
- $this->mkdir($filePath);
+ $result = $this->createParentDirectories($filePath);
+ if($result === false) {
+ return false;
+ }
}
$source = fopen($tmpFile, 'r');
@@ -2107,4 +2110,22 @@ class View {
}
return [$uid, $filename];
}
+
+ /**
+ * Creates parent non-existing folders
+ *
+ * @param string $filePath
+ * @return bool
+ */
+ private function createParentDirectories($filePath) {
+ $parentDirectory = dirname($filePath);
+ while(!$this->file_exists($parentDirectory)) {
+ $result = $this->createParentDirectories($parentDirectory);
+ if($result === false) {
+ return false;
+ }
+ }
+ $this->mkdir($filePath);
+ return true;
+ }
}