aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-12-16 12:51:56 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-12-17 08:32:15 +0000
commit6393707fe47805b18a0a79febd803093745d2918 (patch)
tree68ac4f7479620c742beeed9f983b211909a9e325
parentbd932b6ee249b4acffcd24d9862e411afddedb32 (diff)
downloadnextcloud-server-backport/49880/stable28.tar.gz
nextcloud-server-backport/49880/stable28.zip
fix(View): Catch exceptions when executing mkdir for non-existent parentsbackport/49880/stable28
Signed-off-by: provokateurin <kate@provokateurin.de>
-rw-r--r--lib/private/Files/View.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index a4a68b2f4a7..50e860c83fc 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -1529,10 +1529,17 @@ class View {
$entryName = substr($relativePath, 0, $pos);
// Create parent folders if the mountpoint is inside a subfolder that doesn't exist yet
- if (!isset($files[$entryName]) && $this->mkdir($path . '/' . $entryName) !== false) {
- $info = $this->getFileInfo($path . '/' . $entryName);
- if ($info !== false) {
- $files[$entryName] = $info;
+ if (!isset($files[$entryName])) {
+ try {
+ if ($this->mkdir($path . '/' . $entryName) !== false) {
+ $info = $this->getFileInfo($path . '/' . $entryName);
+ if ($info !== false) {
+ $files[$entryName] = $info;
+ }
+ }
+ } catch (\Exception $e) {
+ // Creating the parent folder might not be possible, for example due to a lack of permissions.
+ $this->logger->debug('Failed to create non-existent parent', ['exception' => $e, 'path' => $path . '/' . $entryName]);
}
}