mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-05-07 03:52:41 +08:00
fix: handle FileNotFoundError in dav_get function and return 404 response
This commit is contained in:
@@ -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