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

UTF-8 error in facet processing #78

Open
markphilpot opened this issue Nov 16, 2024 · 0 comments
Open

UTF-8 error in facet processing #78

markphilpot opened this issue Nov 16, 2024 · 0 comments

Comments

@markphilpot
Copy link

skybridge  | ERROR - 2024-11-16 18:08:40.670123
skybridge  | GET /api/v1/timelines/home?limit=40&min_id=1968935019812487168
skybridge  | Error thrown by handler.
skybridge  | FormatException: Unfinished UTF-8 octet sequence (at offset 13)
skybridge  | dart:convert                                              Utf8Codec.decode
skybridge  | package:sky_bridge/facets.dart 104                        processFacets
skybridge  | package:sky_bridge/models/mastodon/mastodon_post.dart 81  MastodonPost.fromFeedView
skybridge  | dart:collection                                           SetBase.toList
skybridge  | build/routes/api/v1/timelines/list/[id].dart 51           onRequest.<fn>
skybridge  | package:sky_bridge/database.dart 18                       databaseTransaction
skybridge  | build/routes/api/v1/timelines/home.dart 43                onRequest

While processing a post, it looks like BlueSky can return some improperly formatted content. The issue is that this exception causes no further posts to show up in Ivory. The workaround is to reset the cache in the Ivory client, but ideally SkyBridge should just skip the the bad post and continue processing.

Making the list processing in routes/api/v1/timelines/list/[id].dart more resilient to a bad post is the best way to handle it

// Take all the posts and convert them to Mastodon ones
// Await all the futures, getting any necessary data from the database.
final posts = await databaseTransaction(() async {
  final futures = feed.data.feed.map(MastodonPost.fromFeedView).toList();
  return Future.wait(futures);
});
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

1 participant