fix: prepend session GUID to filename when calling backend analyze
When files are stored in /mnt/converter/in/{guid}/, the backend
needs the full relative path. The analyze endpoint now constructs
'{guid}/{filename}' before passing to the backend API.
This commit is contained in:
parent
e53d05f7dc
commit
bc20691390
2 changed files with 13 additions and 1 deletions
8
clean.sh
Executable file
8
clean.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
/mnt/converter tree
|
||||||
|
rm -rf /mnt/converter/in/*
|
||||||
|
rm -rf /mnt/converter/out/*
|
||||||
|
rm -rf /mnt/converter/backend/__pycache__/
|
||||||
|
systemctl restart vm-bench-backend.service
|
||||||
|
systemctl status vm-bench-backend.service
|
||||||
|
tree /mnt/converter/
|
||||||
|
|
@ -428,14 +428,18 @@ async def session_analyze(
|
||||||
vmid: int = Form(...),
|
vmid: int = Form(...),
|
||||||
filename: str = Form(...),
|
filename: str = Form(...),
|
||||||
vm_name: str = Form(""),
|
vm_name: str = Form(""),
|
||||||
|
session_id: str = Form(""),
|
||||||
):
|
):
|
||||||
"""Phase 2 — call the backend /analyze endpoint and render the result."""
|
"""Phase 2 — call the backend /analyze endpoint and render the result."""
|
||||||
err = _validate_vmid(vmid)
|
err = _validate_vmid(vmid)
|
||||||
if err:
|
if err:
|
||||||
return render("_analysis.html", request=request, error=err)
|
return render("_analysis.html", request=request, error=err)
|
||||||
|
|
||||||
|
# Prepend session subdirectory to the filename for the backend
|
||||||
|
backend_filename = f"{session_id}/{filename}" if session_id else filename
|
||||||
|
|
||||||
try:
|
try:
|
||||||
analysis = api.analyze(vmid=vmid, filename=filename)
|
analysis = api.analyze(vmid=vmid, filename=backend_filename)
|
||||||
except ApiError as exc:
|
except ApiError as exc:
|
||||||
return render("_analysis.html", request=request,
|
return render("_analysis.html", request=request,
|
||||||
error=f"Backend analysis failed: {exc.detail}")
|
error=f"Backend analysis failed: {exc.detail}")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue