WebDAV MKCOL: return 405 Exists if directory already exists (RFC 4918)
P3 fix: - create_dir: check vfs.exists() before creating - Return FsError::Exists (405 Method Not Allowed) if path exists Tests: 36 webdav tests pass
This commit is contained in:
@@ -645,6 +645,9 @@ impl DavFileSystem for VfsDavFs {
|
|||||||
Ok(p) => p,
|
Ok(p) => p,
|
||||||
Err(e) => return Box::pin(std::future::ready(Err(e))),
|
Err(e) => return Box::pin(std::future::ready(Err(e))),
|
||||||
};
|
};
|
||||||
|
if self.vfs.exists(&full_path) {
|
||||||
|
return Box::pin(std::future::ready(Err(FsError::Exists)));
|
||||||
|
}
|
||||||
match self.vfs.create_dir_all(&full_path, 0o755) {
|
match self.vfs.create_dir_all(&full_path, 0o755) {
|
||||||
Ok(_) => Box::pin(std::future::ready(Ok(()))),
|
Ok(_) => Box::pin(std::future::ready(Ok(()))),
|
||||||
Err(_) => Box::pin(std::future::ready(Err(FsError::NotImplemented))),
|
Err(_) => Box::pin(std::future::ready(Err(FsError::NotImplemented))),
|
||||||
|
|||||||
Reference in New Issue
Block a user