Skip to content

Commit

Permalink
fix: fix get install info not ready cause panic
Browse files Browse the repository at this point in the history
  • Loading branch information
CorrectRoadH committed May 17, 2024
1 parent 4e5f473 commit 04bcc19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion route/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,16 @@ func (a *api) GetInstall(ctx echo.Context) error {
})
}

if release == nil {
return ctx.JSON(http.StatusInternalServerError, &codegen.ResponseInternalServerError{
Message: lo.ToPtr("release is not ready"),
})
}

path, err := service.InstallerService.InstallInfo(*release, config.SysRoot)
if err != nil {
return ctx.JSON(http.StatusInternalServerError, &codegen.ResponseInternalServerError{
Message: utils.Ptr(err.Error()),
Message: lo.ToPtr(err.Error()),
})
}
return ctx.JSON(http.StatusOK, &codegen.InstallInfoOk{
Expand Down
1 change: 1 addition & 0 deletions service/status_serivce.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func (r *StatusService) Install(release codegen.Release, sysRoot string) error {
}

func (r *StatusService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error) {
// TODO: cache release in disk
return r.release, nil
}

Expand Down

0 comments on commit 04bcc19

Please sign in to comment.