Commit 5a61dbca authored by Mustafa Gezen's avatar Mustafa Gezen 🏗
Browse files

Merge branch 'fix/protect-api' into 'main'

fix: A couple other routes need protecting

See merge request !1
parents 2679b08c e6fde354
......@@ -63,6 +63,8 @@ async def get_build(build_id: int):"/{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):"/{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