aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKate <26026535+provokateurin@users.noreply.github.com>2024-12-17 11:10:47 +0100
committerGitHub <noreply@github.com>2024-12-17 11:10:47 +0100
commit164af6229c8978be40f7034e9da51ffac05da77a (patch)
treeb1922c677e8d95732bcb8b6de1fa61d4e08acd29
parent089a5fd827b3d97448e6998b661b4ae48f537fbc (diff)
parent5cc14e261878aef3194957338df41885ba709bf4 (diff)
downloadnextcloud-server-164af6229c8978be40f7034e9da51ffac05da77a.tar.gz
nextcloud-server-164af6229c8978be40f7034e9da51ffac05da77a.zip
Merge pull request #49894 from nextcloud/backport/49880/stable30
[stable30] fix(View): Catch exceptions when executing mkdir for non-existent parents
-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 db2483fab76..738e1442b67 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -1498,10 +1498,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]);
}
}