diff options
| author | LHHDZ <changlin.shi@ly.com> | 2022-12-12 14:49:57 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-11 22:49:57 -0800 |
| commit | bb289d7d69f27e0ccef72d727053889eb6e37f9e (patch) | |
| tree | 53ba617e323e7c7077fb0e1a5cb011eb4593645a | |
| parent | 438146249f50bf36b4c46ece02a430f44152777f (diff) | |
| download | seaweedfs-bb289d7d69f27e0ccef72d727053889eb6e37f9e.tar.xz seaweedfs-bb289d7d69f27e0ccef72d727053889eb6e37f9e.zip | |
sort tags by key (#4047)
Signed-off-by: changlin.shi <changlin.shi@ly.com>
Signed-off-by: changlin.shi <changlin.shi@ly.com>
| -rw-r--r-- | weed/s3api/tags.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/weed/s3api/tags.go b/weed/s3api/tags.go index 0fc32241f..3df44fae0 100644 --- a/weed/s3api/tags.go +++ b/weed/s3api/tags.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/seaweedfs/seaweedfs/weed/util" "regexp" + "sort" "strings" ) @@ -39,6 +40,11 @@ func FromTags(tags map[string]string) (t *Tagging) { 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 } |
