镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
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
17 changes: 15 additions & 2 deletions lib/private/Files/Node/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,21 @@ public function newFolder($path) {
$fullPath = $this->getFullPath($path);
$nonExisting = new NonExistingFolder($this->root, $this->view, $fullPath);
$this->sendHooks(['preWrite', 'preCreate'], [$nonExisting]);
if (!$this->view->mkdir($fullPath) && !$this->view->is_dir($fullPath)) {
throw new NotPermittedException('Could not create folder "' . $fullPath . '"');
if (!$this->view->mkdir($fullPath)) {
// maybe another concurrent process created the folder already
if (!$this->view->is_dir($fullPath)) {
throw new NotPermittedException('Could not create folder "' . $fullPath . '"');
} else {
// we need to ensure we don't return before the concurrent request has finished updating the cache
$tries = 5;
while (!$this->view->getFileInfo($fullPath)) {
if ($tries < 1) {
throw new NotPermittedException('Could not create folder "' . $fullPath . '", folder exists but unable to get cache entry');
}
usleep(5 * 1000);
$tries--;
}
}
}
$parent = dirname($fullPath) === $this->getPath() ? $this : null;
$node = new Folder($this->root, $this->view, $fullPath, null, $parent);
Expand Down