Browse Source

lib/config: Sort versioning options on marshal (fixes #6576) (#6577)

Jakob Borg 5 years ago
parent
commit
8c61e0d6ab
1 changed files with 7 additions and 1 deletions
  1. 7 1
      lib/config/versioningconfiguration.go

+ 7 - 1
lib/config/versioningconfiguration.go

@@ -6,7 +6,10 @@
 
 package config
 
-import "encoding/xml"
+import (
+	"encoding/xml"
+	"sort"
+)
 
 type VersioningConfiguration struct {
 	Type   string            `xml:"type,attr" json:"type"`
@@ -38,6 +41,9 @@ func (c *VersioningConfiguration) MarshalXML(e *xml.Encoder, start xml.StartElem
 	for k, v := range c.Params {
 		tmp.Params = append(tmp.Params, InternalParam{k, v})
 	}
+	sort.Slice(tmp.Params, func(a, b int) bool {
+		return tmp.Params[a].Key < tmp.Params[b].Key
+	})
 
 	return e.EncodeElement(tmp, start)