diff options
author | Kate <26026535+provokateurin@users.noreply.github.com> | 2024-12-17 11:10:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-17 11:10:47 +0100 |
commit | 164af6229c8978be40f7034e9da51ffac05da77a (patch) | |
tree | b1922c677e8d95732bcb8b6de1fa61d4e08acd29 | |
parent | 089a5fd827b3d97448e6998b661b4ae48f537fbc (diff) | |
parent | 5cc14e261878aef3194957338df41885ba709bf4 (diff) | |
download | nextcloud-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.php | 15 |
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]); } } |