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

ListObjectsEnumAsync gives an System.Xml.XmlException: Root element is missing. #1184

Open
wouterDevelop opened this issue Sep 30, 2024 · 1 comment

Comments

@wouterDevelop
Copy link

I tried to implement the new ListObjectsEnumAsync function. But when I execute it, the code crashed and gives the following error:

    An unhandled exception has occurred while executing the request.
      System.Xml.XmlException: Root element is missing.
         at System.Xml.XmlTextReaderImpl.Throw(Exception e)
         at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)
         at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
         at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
         at System.Xml.Linq.XDocument.Load(Stream stream, LoadOptions options)
         at Minio.MinioClient.ListObjectsEnumAsync(ListObjectsArgs args, CancellationToken cancellationToken)+MoveNext()
         at Minio.MinioClient.ListObjectsEnumAsync(ListObjectsArgs args, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()

when I have logging enabled, I get I think a getting a valid xml from the minio server

<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>mediastorage</Name><Prefix></Prefix><KeyCount>3</KeyCount><MaxKeys>1000</MaxKeys><IsTruncated>false</IsTruncated><Contents><Key>7c9c9a49-8818-4d94-a2bc-d59e4caf6fea</Key><LastModified>2024-09-29T12:36:51.211Z</LastModified><ETag>&#34;449f26d4372db066e6ea857935e74c10&#34;</ETag><Size>95476</Size><StorageClass>STANDARD</StorageClass></Contents><Contents><Key>936d03a9-971a-495b-a980-87c72fd69037_IMG_0343.jpg</Key><LastModified>2024-09-29T13:11:17.382Z</LastModified><ETag>&#34;449f26d4372db066e6ea857935e74c10&#34;</ETag><Size>95476</Size><StorageClass>STANDARD</StorageClass></Contents><Contents><Key>a1b9b74b-3628-430a-890e-2546d225c714</Key><LastModified>2024-09-29T13:00:46.271Z</LastModified><ETag>&#34;449f26d4372db066e6ea857935e74c10&#34;</ETag><Size>95476</Size><StorageClass>STANDARD</StorageClass></Contents><EncodingType>url</EncodingType></ListBucketResult>

this is the code is used to get the objects:

            .WithBucket(BUCKETNAME)
                .WithPrefix(null)
                .WithRecursive(true)
                .WithVersions(false);


        var photos = new List<Photo>();


        await foreach (var item in _minioClient.ListObjectsEnumAsync(listArgs))
        {

            photos.Add(new Photo
            {
                Src = item.Key,
                CreatedAt = item.LastModifiedDateTime,

            });

        }

I hope someone can figure out what's wrong here

@davidlahuta
Copy link

Any luck? How did you resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants