mirror of
https://github.com/pgsty/minio.git
synced 2026-07-24 06:26:17 +03:00
lifecycle: Support tags with special characters (#14906)
Object tags can have special characters such as whitespace. However the current code doesn't properly consider those characters while evaluating the lifecycle document. ObjectInfo.UserTags contains an url encoded form of object tags (e.g. key+1=val) This commit fixes the issue by using the tags package to parse object tags.
This commit is contained in:
@@ -325,6 +325,14 @@ func TestComputeActions(t *testing.T) {
|
||||
objectModTime: time.Now().UTC().Add(-24 * time.Hour), // Created 1 day ago
|
||||
expectedAction: DeleteAction,
|
||||
},
|
||||
// Should remove (Tags with encoded chars)
|
||||
{
|
||||
inputConfig: `<LifecycleConfiguration><Rule><Filter><And><Tag><Key>factory</Key><Value>true</Value></Tag><Tag><Key>store forever</Key><Value>false</Value></Tag></And></Filter><Status>Enabled</Status><Expiration><Date>` + time.Now().Truncate(24*time.Hour).UTC().Add(-24*time.Hour).Format(time.RFC3339) + `</Date></Expiration></Rule></LifecycleConfiguration>`,
|
||||
objectName: "fooobject",
|
||||
objectTags: "store+forever=false&factory=true",
|
||||
objectModTime: time.Now().UTC().Add(-24 * time.Hour), // Created 1 day ago
|
||||
expectedAction: DeleteAction,
|
||||
},
|
||||
|
||||
// Should not remove (Tags don't match)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user