mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-31 03:51:23 +01:00
Merge pull request #8948 from reasonerjt/empty-project-cve-item-list
The default item list should be empty list,not null
This commit is contained in:
commit
09bb364b68
@ -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