Unverified Commit e6fde354 authored by Neil Hanlon's avatar Neil Hanlon
Browse files

fix: A couple other routes need protecting

parent 7e380edf
......@@ -63,6 +63,8 @@ async def get_build(build_id: int):
@router.post("/{build_id}/cancel", status_code=202)
async def cancel_build(build_id: int):
build_obj = await Build.filter(id=build_id, cancelled=False).get_or_none()
if not build_obj:
raise HTTPException(404, detail="build does not exist or is already cancelled")
......@@ -72,6 +72,8 @@ async def get_import_logs(import_id: int):
@router.post("/{import_id}/cancel", status_code=202)
async def cancel_import(import_id: int):
user = get_user(request)
import_obj = await Import.filter(id=import_id, cancelled=False).get_or_none()
if not import_obj:
raise HTTPException(404, detail="import does not exist or is already cancelled")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment