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
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!
The text was updated successfully, but these errors were encountered:
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!
The text was updated successfully, but these errors were encountered: