Skip to content

Commit

Permalink
Fix panic error in ListDeployments API (#4650)
Browse files Browse the repository at this point in the history
  • Loading branch information
seitarof authored Nov 4, 2023
1 parent fd5af4b commit 383f044
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/app/server/grpcapi/web_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ func (a *WebAPI) ListDeployments(ctx context.Context, req *webservice.ListDeploy
Value: req.PageMinUpdatedAt,
},
}

var labels map[string]string
if o := req.Options; o != nil {
// Allowing multiple so that it can do In Query later.
// Currently only the first value is used.
Expand Down Expand Up @@ -862,6 +864,9 @@ func (a *WebAPI) ListDeployments(ctx context.Context, req *webservice.ListDeploy
Value: o.ApplicationName,
})
}
if o.Labels != nil {
labels = o.Labels
}
}

pageSize := int(req.PageSize)
Expand All @@ -876,7 +881,6 @@ func (a *WebAPI) ListDeployments(ctx context.Context, req *webservice.ListDeploy
a.logger.Error("failed to get deployments", zap.Error(err))
return nil, gRPCStoreError(err, "get deployments")
}
labels := req.Options.Labels
if len(labels) == 0 || len(deployments) == 0 {
return &webservice.ListDeploymentsResponse{
Deployments: deployments,
Expand Down

0 comments on commit 383f044

Please sign in to comment.