Browse Source

sort tags by key (#4047)

Signed-off-by: changlin.shi <changlin.shi@ly.com>

Signed-off-by: changlin.shi <changlin.shi@ly.com>
pull/4051/head
LHHDZ 2 years ago
committed by GitHub
parent
commit
bb289d7d69
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      weed/s3api/tags.go

6
weed/s3api/tags.go

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"github.com/seaweedfs/seaweedfs/weed/util" "github.com/seaweedfs/seaweedfs/weed/util"
"regexp" "regexp"
"sort"
"strings" "strings"
) )
@ -39,6 +40,11 @@ func FromTags(tags map[string]string) (t *Tagging) {
Value: v, Value: v,
}) })
} }
if tagArr := t.TagSet.Tag; len(tagArr) > 0 {
sort.SliceStable(tagArr, func(i, j int) bool {
return tagArr[i].Key < tagArr[j].Key
})
}
return return
} }

Loading…
Cancel
Save