Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(View): Catch exceptions when executing mkdir for non-existent parents #49880

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -1512,10 +1512,17 @@ public function getDirectoryContent($directory, $mimetype_filter = '', ?\OCP\Fil
$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) {
provokateurin marked this conversation as resolved.
Show resolved Hide resolved
// 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]);
}
}

Expand Down
Loading