lukepighetti / mastodon_dart

Unofficial 🐘 client written in 🎯
https://pub.dev/packages/mastodon_dart
MIT License
28 stars 8 forks source link

Handle malformed Card#authorUrl parsing #51

Closed abraham closed 1 year ago

abraham commented 1 year ago

I ran across https://mastodon.social/@GIbiz/109626791400616879 which returns a malformed author_url value.

"author_url": "[\"https://www.gamesindustry.biz/authors/brendan-sinclair\", \"https://twitter.com/BrendanSinclair\"]",
abraham commented 1 year ago

Maybe it would be better to use https://api.flutter.dev/flutter/dart-core/Uri/tryParse.html and not try to parse the encoded value.

lukepighetti commented 1 year ago

If I understand correctly... what if we made the authorUrl field a List<Uri> and then made a custom deserializer that can handle both a single Uri value and multiple encoded as a JSON list?

If that doesn't make any sense, then this looks fine to me

abraham commented 1 year ago

I've switched it to the simpler Uri.tryParse. This case feels like the exception not the rule and a bug in Mastodon so I'll try and get a bug fix implemented there.

lukepighetti commented 1 year ago

Merge conflicts from #53

lukepighetti commented 1 year ago

Looks like generate step can't push to your branch, you'll have to regenerate and push manually

abraham commented 1 year ago

Updated.