From 5d2ad2479b6aedcd0cd711577324f089488ec3bb Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 5 Aug 2025 22:02:25 +0800 Subject: [PATCH] :bug: Fix post service load poll --- DysonNetwork.Sphere/Post/PostService.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/DysonNetwork.Sphere/Post/PostService.cs b/DysonNetwork.Sphere/Post/PostService.cs index 7cd430e..3d34168 100644 --- a/DysonNetwork.Sphere/Post/PostService.cs +++ b/DysonNetwork.Sphere/Post/PostService.cs @@ -1,3 +1,4 @@ +using System.Text.Json; using System.Text.RegularExpressions; using AngleSharp.Common; using DysonNetwork.Shared; @@ -667,8 +668,14 @@ public partial class PostService( if (!post.Meta!.TryGetValue("embeds", out var value)) return; - var embeds = (List>)value; - + var embeds = value switch + { + JsonElement e => e.Deserialize>>(), + _ => null + }; + if (embeds is null) + return; + // Find the index of the poll embed first var pollIndex = embeds.FindIndex(e => e.ContainsKey("type") && (string)e["type"] == "poll");