You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
listBuckets assumes XML type but type is not guaranteed #49
When parsing the XML results for providers like Backblaze it is not guaranteed that XML is going to be of type XmlElement. In my case there were XmlText objects. Because of this, it would throw a parsing error.
3.5.5 code in the listBuckets() function in minio.dart line 486.
return bucketsNode.children
.map((n) => Bucket.fromXml(n as XmlElement))
.toList();
Notice it assumes the type to be XmlElement as parses it as such but that is not guaranteed. Below is a change I suggest which avoids throwing errors by checking the type and not relying on type assumption:
List results = [];
for (xml.XmlNode node in bucketsNode.children) {
if (node is xml.XmlElement) {
results.add(Bucket.fromXml(node as XmlElement));
}
}
Im sure there is a more professional and elegant way to write the code than what I've written, but without type safety I need to fork your code with this change or things break with BackBlaze. Thanks!
Fixed in the fork. The children of <Buckets> are not guaranteed to be
elements — a server that indents its XML puts whitespace text nodes between
them — so the cast is gone:
Activity
arrrrny commentedon Oct 22, 2026
Fixed in the fork. The children of
<Buckets>are not guaranteed to beelements — a server that indents its XML puts whitespace text nodes between
them — so the cast is gone:
arrrrny commentedon Oct 22, 2026
This ships in zuraffa_minio — the maintained fork of this package, which upstream has not touched since August 2025.
The fork keeps the API of the original package unchanged, so moving over is an import swap:
Source, the changelog and the sweep of the open issues of this tracker: https://github.com/arrrrny/zuraffa_minio