mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-09-05 23:57:19 +08:00
fix: handle create-root request gracefully in write_file_stream
This commit is contained in:
@@ -307,7 +307,12 @@ async def write_file_stream(path: str, data_iter: AsyncIterator[bytes], overwrit
|
|||||||
async def make_dir(path: str):
|
async def make_dir(path: str):
|
||||||
adapter_instance, _, root, rel = await resolve_adapter_and_rel(path)
|
adapter_instance, _, root, rel = await resolve_adapter_and_rel(path)
|
||||||
if not rel:
|
if not rel:
|
||||||
raise HTTPException(400, detail="Cannot create root")
|
await LogService.info(
|
||||||
|
"virtual_fs",
|
||||||
|
f"Ignored create-root request for {path}",
|
||||||
|
details={"path": path, "reason": "root directory already exists"},
|
||||||
|
)
|
||||||
|
return
|
||||||
mkdir_func = await _ensure_method(adapter_instance, "mkdir")
|
mkdir_func = await _ensure_method(adapter_instance, "mkdir")
|
||||||
await mkdir_func(root, rel)
|
await mkdir_func(root, rel)
|
||||||
await LogService.action("virtual_fs", f"Created directory {path}", details={"path": path})
|
await LogService.action("virtual_fs", f"Created directory {path}", details={"path": path})
|
||||||
|
|||||||
Reference in New Issue
Block a user