aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-06-26 12:55:05 +0200
committerLukas Reschke <lukas@owncloud.com>2016-06-26 12:55:05 +0200
commit7a9d60d87eb8e4414e5fe05830b088d426ff810d (patch)
tree0fc97a7eacfd071475afd8bc6d4372babacb5740 /lib/private/Files
parent5387b942c44e05b87ba2a0fd54168f5278a31344 (diff)
parent52eab2a61a5d27b64fcd0440b91f854c052933a9 (diff)
downloadnextcloud-server-7a9d60d87eb8e4414e5fe05830b088d426ff810d.tar.gz
nextcloud-server-7a9d60d87eb8e4414e5fe05830b088d426ff810d.zip
Merge remote-tracking branch 'upstream/master' into master-upstream-sync
Diffstat (limited to 'lib/private/Files')
-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;
+ }
}