storj/gateway-st

GetObjectTagging is not keeping tags list order

Open

#79 opened on Jan 18, 2024

 (1 comment) (0 reactions) (0 assignees)Go (19 forks)auto 404
buggood first issue

Repository metrics

Stars
 (82 stars)
PR merge metrics
 (PR metrics pending)

Description

Minio implementation is encoding GetObjectTagging results without keeping the same order as input keys. It's not a big problem but because of that some ceph tests are flaky (e.g. test_get_obj_tagging). Test to describe issue:

func TestTags(t *testing.T) {
	tt, err := tags.NewTags(map[string]string{
		"0": "0",
		"1": "1",
	}, true)
	require.NoError(t, err)

	var bytesBuffer bytes.Buffer
	e := xml.NewEncoder(&bytesBuffer)
	err = e.Encode(tt)
	require.NoError(t, err)

	require.Equal(t, "<Tagging><TagSet><Tag><Key>0</Key><Value>0</Value></Tag><Tag><Key>1</Key><Value>1</Value></Tag></TagSet></Tagging>", bytesBuffer.String())
}

https://github.com/storj/minio/blob/eb9c3875df54210b47a60fb92a069449131fcfc9/cmd/object-handlers.go#L3555

Contributor guide