🐛 Fix post service load poll

This commit is contained in:
2025-08-05 22:02:25 +08:00
parent 795ca04d7c
commit 5d2ad2479b

View File

@@ -1,3 +1,4 @@
using System.Text.Json;
using System.Text.RegularExpressions;
using AngleSharp.Common;
using DysonNetwork.Shared;
@@ -667,7 +668,13 @@ public partial class PostService(
if (!post.Meta!.TryGetValue("embeds", out var value))
return;
var embeds = (List<Dictionary<string, object>>)value;
var embeds = value switch
{
JsonElement e => e.Deserialize<List<Dictionary<string, object>>>(),
_ => null
};
if (embeds is null)
return;
// Find the index of the poll embed first
var pollIndex = embeds.FindIndex(e =>