From f8871dd2c1bae216ccfe161493d7618e7d08980c Mon Sep 17 00:00:00 2001 From: seveibar Date: Tue, 3 Dec 2024 21:30:13 +0800 Subject: [PATCH] speculative fix for #388 --- .../java/app/freerouting/api/v1/JobControllerV1.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/app/freerouting/api/v1/JobControllerV1.java b/src/main/java/app/freerouting/api/v1/JobControllerV1.java index 8e799dd6b..e8472d126 100644 --- a/src/main/java/app/freerouting/api/v1/JobControllerV1.java +++ b/src/main/java/app/freerouting/api/v1/JobControllerV1.java @@ -361,10 +361,10 @@ public Response downloadOutput( return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"The session ID '" + job.sessionId + "' is invalid.\"}").build(); } - // Check if the job is completed - if (job.state != RoutingJobState.COMPLETED) - { - return Response.status(Response.Status.BAD_REQUEST).entity("{\"error\":\"The job hasn't finished yet.\"}").build(); + // Return current output if available, even if job isn't completed + if (job.output == null || job.output.getData() == null) { + return Response.status(Response.Status.NO_CONTENT) + .entity("{\"message\":\"No output available yet.\"}").build(); } var result = new BoardFilePayload(); @@ -411,4 +411,4 @@ public Response logs( FRAnalytics.apiEndpointCalled("GET v1/jobs/" + jobId + "/logs", "", response); return Response.ok(response).build(); } -} \ No newline at end of file +}