mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Fix a panic when downloading a software installer that exists in the DB but not in the storage (#19527)
This commit is contained in:
parent
de0562a686
commit
96c8139c02
3 changed files with 5 additions and 1 deletions
1
changes/19324-fix-panic-in-download-software
Normal file
1
changes/19324-fix-panic-in-download-software
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Fixed a panic (API returning code 500) when the software installer exists in the database but the installer does not exist in the storage.
|
||||
|
|
@ -181,7 +181,7 @@ func (svc *Service) getSoftwareInstallerBinary(ctx context.Context, storageID st
|
|||
return nil, ctxerr.Wrap(ctx, err, "checking if installer exists")
|
||||
}
|
||||
if !exists {
|
||||
return nil, ctxerr.Wrap(ctx, err, "does not exist in software installer store")
|
||||
return nil, ctxerr.Wrap(ctx, notFoundError{}, "does not exist in software installer store")
|
||||
}
|
||||
|
||||
// get the installer from the store
|
||||
|
|
|
|||
|
|
@ -9423,6 +9423,9 @@ func (s *integrationEnterpriseTestSuite) TestSoftwareInstallerUploadDownloadAndD
|
|||
|
||||
// check activity
|
||||
s.lastActivityOfTypeMatches(fleet.ActivityTypeDeletedSoftware{}.ActivityName(), fmt.Sprintf(`{"software_title": "ruby", "software_package": "ruby.deb", "team_name": "%s", "team_id": %d, "self_service": true}`, createTeamResp.Team.Name, createTeamResp.Team.ID), 0)
|
||||
|
||||
// download the installer, not found anymore
|
||||
s.Do("GET", fmt.Sprintf("/api/latest/fleet/software/%d/package?alt=media", titleID), nil, http.StatusNotFound, "team_id", fmt.Sprintf("%d", *payload.TeamID))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue