aicam commented on code in PR #7922:
URL: https://github.com/apache/texera/pull/7922#discussion_r3859122131
##########
file-service/src/main/scala/org/apache/texera/service/resource/ModelResource.scala:
##########
@@ -408,4 +474,513 @@ class ModelResource extends LazyLogging {
): DashboardModel = {
withTransaction(context)(ctx => getDashboardModel(ctx, mid, None))
}
+
+ @GET
+ @RolesAllowed(Array("REGULAR", "ADMIN"))
+ @Path("/{mid}/versionZip")
+ def getModelVersionZip(
+ @PathParam("mid") mid: Integer,
+ @QueryParam("mvid") mvid: Integer,
+ @QueryParam("latest") latest: java.lang.Boolean,
+ @Auth user: SessionUser
+ ): Response =
+ withTransaction(context) { ctx =>
+ if ((mvid != null && latest != null) || (mvid == null && latest ==
null)) {
Review Comment:
`latest=false` is accepted and behaves as `latest=true`: the guard only
tests `latest != null`, and the branch below falls through to
`getLatestModelVersion` for any non-null value. `?latest=false` returns the
latest zip instead of a 400.
`DatasetResource` (~L1017) handles this with
`java.lang.Boolean.TRUE.equals(latest)` plus an `else throw new
BadRequestException`. Not covered by the new tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]