fix: handle FileNotFoundError in dav_get function and return 404 response
This commit is contained in:
1 parent
d7aa3f1796
commit
ca500cbbf8
1 file changed
+4
-1
@@ -252,7 +252,10 @@ async def dav_get(
|
||||
if full_path != "/":
|
||||
await PermissionService.require_path_permission(user.id, full_path, PathAction.READ)
|
||||
range_header = request.headers.get("Range")
|
||||
return await VirtualFSService.stream_file(full_path, range_header)
|
||||
try:
|
||||
return await VirtualFSService.stream_file(full_path, range_header)
|
||||
except FileNotFoundError:
|
||||
raise HTTPException(404, detail="Not found")
|
||||
|
||||
|
||||
@router.head("/{path:path}")
|
||||
|
||||
Reference in new issue
Block a user