From 27c0d60812719e628367bf71cb53989ef454e323 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 31 Dec 2025 16:50:20 +0000 Subject: [PATCH] Remove conditional checks for canonical URLs in HTML and JSON exports Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> --- .../Exporting/JsonMessageWriter.cs | 28 +++---------------- .../Exporting/MessageGroupTemplate.cshtml | 26 ++++++++--------- 2 files changed, 15 insertions(+), 39 deletions(-) diff --git a/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs b/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs index cf3ee38d..1b90ec02 100644 --- a/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs @@ -138,12 +138,7 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) cancellationToken ) ); - - // Include canonical URL if present - if (!string.IsNullOrWhiteSpace(embedAuthor.IconUrl)) - { - _writer.WriteString("iconCanonicalUrl", embedAuthor.IconUrl); - } + _writer.WriteString("iconCanonicalUrl", embedAuthor.IconUrl); } _writer.WriteEndObject(); @@ -166,12 +161,7 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) cancellationToken ) ); - - // Include canonical URL if present - if (!string.IsNullOrWhiteSpace(embedImage.Url)) - { - _writer.WriteString("canonicalUrl", embedImage.Url); - } + _writer.WriteString("canonicalUrl", embedImage.Url); } _writer.WriteNumber("width", embedImage.Width); @@ -197,12 +187,7 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) cancellationToken ) ); - - // Include canonical URL if present - if (!string.IsNullOrWhiteSpace(embedVideo.Url)) - { - _writer.WriteString("canonicalUrl", embedVideo.Url); - } + _writer.WriteString("canonicalUrl", embedVideo.Url); } _writer.WriteNumber("width", embedVideo.Width); @@ -230,12 +215,7 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) cancellationToken ) ); - - // Include canonical URL if present - if (!string.IsNullOrWhiteSpace(embedFooter.IconUrl)) - { - _writer.WriteString("iconCanonicalUrl", embedFooter.IconUrl); - } + _writer.WriteString("iconCanonicalUrl", embedFooter.IconUrl); } _writer.WriteEndObject(); diff --git a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml index ffeaa745..e27fad2b 100644 --- a/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml +++ b/DiscordChatExporter.Core/Exporting/MessageGroupTemplate.cshtml @@ -388,7 +388,7 @@