ListResources is repeating the last image
I am using the following code to get a list of all resources that match a specific tag. The problem is the results are infinite. The last resource just repeats forever and NextCursor is never null.
Cloudinary cloudinary = new Cloudinary("removed");
cloudinary.Api.Secure = true;
var listResourceParams = new ListResourcesByTagParams()
{
Metadata = true,
Tag = "Lifestyle",
MaxResults = 10
};
var allImages = new List<Resource>();
bool firstRun = true;
while (firstRun || !string.IsNullOrEmpty(listResourceParams.NextCursor))
{
firstRun = false;
var getResourceResult = cloudinary.ListResources(listResourceParams);
allImages.AddRange(getResourceResult.Resources.ToList());
listResourceParams.NextCursor = getResourceResult.NextCursor;
}
-
Hi Karl. Danny from Cloudinary Support here.
I'm glad to hear you were able to pinpoint where the issue was coming from. If you need us in the future, please don't hesitate to get in touch either with a forum post, or by submitting a new support request.
All the best,
-Danny
Post is closed for comments.
Comments
3 comments