mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-09-08 00:56:49 +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 != "/":
|
if full_path != "/":
|
||||||
await PermissionService.require_path_permission(user.id, full_path, PathAction.READ)
|
await PermissionService.require_path_permission(user.id, full_path, PathAction.READ)
|
||||||
range_header = request.headers.get("Range")
|
range_header = request.headers.get("Range")
|
||||||
|
try:
|
||||||
return await VirtualFSService.stream_file(full_path, range_header)
|
return await VirtualFSService.stream_file(full_path, range_header)
|
||||||
|
except FileNotFoundError:
|
||||||
|
raise HTTPException(404, detail="Not found")
|
||||||
|
|
||||||
|
|
||||||
@router.head("/{path:path}")
|
@router.head("/{path:path}")
|
||||||
|
|||||||
Reference in New Issue
Block a user