mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-18 08:15:16 +01:00
Merge pull request #9919 from wy65701436/fix-9880
add empter result to list immutable rules
This commit is contained in:
commit
70a2930330
@ -65,7 +65,7 @@ func (i *immutableRuleDao) GetImmutableRule(id int64) (*model.ImmutableRule, err
|
||||
func (i *immutableRuleDao) QueryImmutableRuleByProjectID(projectID int64) ([]model.ImmutableRule, error) {
|
||||
o := dao.GetOrmer()
|
||||
qs := o.QueryTable(&model.ImmutableRule{}).Filter("ProjectID", projectID)
|
||||
var r []model.ImmutableRule
|
||||
r := make([]model.ImmutableRule, 0)
|
||||
_, err := qs.All(&r)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get immutable tag rule by projectID %d, error: %v", projectID, err)
|
||||
|
@ -79,7 +79,7 @@ func (drm *defaultRuleManager) QueryImmutableRuleByProjectID(projectID int64) ([
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var rules []model.Metadata
|
||||
rules := make([]model.Metadata, 0)
|
||||
for _, daoRule := range daoRules {
|
||||
rule := model.Metadata{}
|
||||
if err = json.Unmarshal([]byte(daoRule.TagFilter), &rule); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user