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

Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
provokateurin 2024-12-16 12:51:56 +01:00
parent f9ee3505a0
commit 4bc0b58c59
No known key found for this signature in database

View file

@ -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]);
}
}