Fix creating a file was creating a directory

This commit is contained in:
bohwaz 2023-10-15 14:58:34 +02:00
parent e94f8d4989
commit 30c342316b

View file

@ -281,7 +281,7 @@ class Storage extends AbstractStorage implements TrashInterface
throw new WebDAV_Exception('Target is a directory', 409); throw new WebDAV_Exception('Target is a directory', 409);
} }
$this->ensureDirectoryExists($uri); $this->ensureDirectoryExists($parent);
$new = !file_exists($target); $new = !file_exists($target);
@ -293,6 +293,10 @@ class Storage extends AbstractStorage implements TrashInterface
$size = 0; $size = 0;
$quota = $this->users->quota($this->users->current()); $quota = $this->users->quota($this->users->current());
if ($quota->free <= 0) {
throw new WebDAV_Exception('Your quota is exhausted', 403);
}
$tmp_dir = sprintf(STORAGE_PATH, '_tmp'); $tmp_dir = sprintf(STORAGE_PATH, '_tmp');
if (!file_exists($tmp_dir)) { if (!file_exists($tmp_dir)) {
@ -399,7 +403,7 @@ class Storage extends AbstractStorage implements TrashInterface
$method = $move ? 'rename' : 'copy'; $method = $move ? 'rename' : 'copy';
if ($method == 'copy' && is_dir($source)) { if ($method == 'copy' && is_dir($source)) {
$this->ensureDirectoryExists($destination); $this->ensureDirectoryExists($parent);
if (!is_dir($target)) { if (!is_dir($target)) {
throw new WebDAV_Exception('Target directory could not be created', 409); throw new WebDAV_Exception('Target directory could not be created', 409);