Skip to content

Commit e10e881

Browse files
Merge pull request #49890 from nextcloud/backport/49880/stable28
[stable28] fix(View): Catch exceptions when executing mkdir for non-existent parents
2 parents bd932b6 + 6393707 commit e10e881

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

lib/private/Files/View.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,10 +1529,17 @@ public function getDirectoryContent($directory, $mimetype_filter = '', \OCP\File
15291529
$entryName = substr($relativePath, 0, $pos);
15301530

15311531
// Create parent folders if the mountpoint is inside a subfolder that doesn't exist yet
1532-
if (!isset($files[$entryName]) && $this->mkdir($path . '/' . $entryName) !== false) {
1533-
$info = $this->getFileInfo($path . '/' . $entryName);
1534-
if ($info !== false) {
1535-
$files[$entryName] = $info;
1532+
if (!isset($files[$entryName])) {
1533+
try {
1534+
if ($this->mkdir($path . '/' . $entryName) !== false) {
1535+
$info = $this->getFileInfo($path . '/' . $entryName);
1536+
if ($info !== false) {
1537+
$files[$entryName] = $info;
1538+
}
1539+
}
1540+
} catch (\Exception $e) {
1541+
// Creating the parent folder might not be possible, for example due to a lack of permissions.
1542+
$this->logger->debug('Failed to create non-existent parent', ['exception' => $e, 'path' => $path . '/' . $entryName]);
15361543
}
15371544
}
15381545

0 commit comments

Comments
 (0)