mirror of
https://github.com/goharbor/harbor.git
synced 2025-03-12 06:32:50 +01:00
The default item list should be empty list,not null
This commit make sure that the "items" in response of project level CVE_whitelist is not null, even when it's null in the DB the API will return an empty list Signed-off-by: Daniel Jiang <jiangd@vmware.com>
This commit is contained in:
parent
250a53cad7
commit
76a79869df
@ -41,6 +41,7 @@ type defaultManager struct{}
|
||||
func (d *defaultManager) CreateEmpty(projectID int64) error {
|
||||
l := models.CVEWhitelist{
|
||||
ProjectID: projectID,
|
||||
Items: []models.CVEWhitelistItem{},
|
||||
}
|
||||
_, err := dao.CreateCVEWhitelist(l)
|
||||
if err != nil {
|
||||
@ -66,6 +67,9 @@ func (d *defaultManager) Get(projectID int64) (*models.CVEWhitelist, error) {
|
||||
log.Debugf("No CVE whitelist found for project %d, returning empty list.", projectID)
|
||||
return &models.CVEWhitelist{ProjectID: projectID, Items: []models.CVEWhitelistItem{}}, nil
|
||||
}
|
||||
if wl.Items == nil {
|
||||
wl.Items = []models.CVEWhitelistItem{}
|
||||
}
|
||||
return wl, err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user