diff options
author | provokateurin <kate@provokateurin.de> | 2024-12-16 12:51:56 +0100 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-12-16 16:00:35 +0100 |
commit | 4bc0b58c59035c689f1dc0c5bde160feb0e8e1f8 (patch) | |
tree | 423363bbedae04712e2fbd8141820a2016f637e1 /lib | |
parent | f9ee3505a073c84e86c3d76485096883e2fff7e6 (diff) | |
download | nextcloud-server-4bc0b58c59035c689f1dc0c5bde160feb0e8e1f8.tar.gz nextcloud-server-4bc0b58c59035c689f1dc0c5bde160feb0e8e1f8.zip |
fix(View): Catch exceptions when executing mkdir for non-existent parentsfix/view/catch-mkdir-exception-non-existent-parents
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib')
-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 66894e0c3cf..e97cd75251d 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1512,10 +1512,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]); } } |