aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKate <26026535+provokateurin@users.noreply.github.com>2024-12-17 09:30:49 +0100
committerGitHub <noreply@github.com>2024-12-17 09:30:49 +0100
commitf16d0478084ca17551a0bc3242e48b633ff23a24 (patch)
tree4fd0879d0e1e2866419cf3fcb306da605414f51c /lib
parent5f00a26c3ad0ad9bac62fafd059abaf2ffab4537 (diff)
parent4bc0b58c59035c689f1dc0c5bde160feb0e8e1f8 (diff)
downloadnextcloud-server-f16d0478084ca17551a0bc3242e48b633ff23a24.tar.gz
nextcloud-server-f16d0478084ca17551a0bc3242e48b633ff23a24.zip
Merge pull request #49880 from nextcloud/fix/view/catch-mkdir-exception-non-existent-parents
fix(View): Catch exceptions when executing mkdir for non-existent parents
Diffstat (limited to 'lib')
-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 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]);
}
}