From eae4ac32bb7b4c481b924121017ec5b6ec8d2cd5 Mon Sep 17 00:00:00 2001 From: NepPure Date: Mon, 15 Jan 2024 11:13:21 +0000 Subject: [PATCH] convert by uri --- Lagrange.OneBot/Core/Message/Entity/ImageSegment.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Lagrange.OneBot/Core/Message/Entity/ImageSegment.cs b/Lagrange.OneBot/Core/Message/Entity/ImageSegment.cs index 1b8c1c943..5bbf9297f 100644 --- a/Lagrange.OneBot/Core/Message/Entity/ImageSegment.cs +++ b/Lagrange.OneBot/Core/Message/Entity/ImageSegment.cs @@ -30,10 +30,7 @@ public void Build(MessageBuilder builder, ISegment segment) if (imageSegment.Url.StartsWith("file")) { - // see: https://github.com/LagrangeDev/Lagrange.Core/issues/69 - string path = imageSegment.Url.Replace("file:///", ""); - path = path.Replace("file://", ""); - path = path.Replace("file:/", ""); + string path = new Uri(imageSegment.Url).AbsolutePath; builder.Image(File.ReadAllBytes(path)); }