Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Prefix property and init of Tags collection in AndOperator (#782) #853

Merged
merged 2 commits into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Minio/DataModel/ILM/AndOperator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2021 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -38,18 +38,23 @@ public AndOperator()
public AndOperator(string prefix, IList<Tag> tag)
{
Prefix = prefix;
if (tag?.Count > 0) Tags = new Collection<Tag>(tag);
if (tag?.Count > 0)
Tags = new Collection<Tag>(tag);
}

public AndOperator(string prefix, IDictionary<string, string> tags)
{
Prefix = prefix;
if (tags is null || tags.Count == 0)
return;
foreach (var item in tags) Tags.Add(new Tag(item.Key, item.Value));

Tags = new Collection<Tag>();

foreach (var item in tags)
Tags.Add(new Tag(item.Key, item.Value));
}

[XmlElement("Prefix")] internal string Prefix { get; set; }
[XmlElement("Prefix")] public string Prefix { get; set; }

[XmlElement(ElementName = "Tag", IsNullable = false)]
public Collection<Tag> Tags { get; set; }
Expand Down