Skip to content

Commit ca500cb

Browse files
committed
fix: handle FileNotFoundError in dav_get function and return 404 response
1 parent d7aa3f1 commit ca500cb

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

domain/virtual_fs/mapping/webdav_api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,10 @@ async def dav_get(
252252
if full_path != "/":
253253
await PermissionService.require_path_permission(user.id, full_path, PathAction.READ)
254254
range_header = request.headers.get("Range")
255-
return await VirtualFSService.stream_file(full_path, range_header)
255+
try:
256+
return await VirtualFSService.stream_file(full_path, range_header)
257+
except FileNotFoundError:
258+
raise HTTPException(404, detail="Not found")
256259

257260

258261
@router.head("/{path:path}")

0 commit comments

Comments
 (0)