From 197c9f39e369e62ee6009e718c13bd1d8d081925 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 31 Dec 2025 16:43:03 +0000 Subject: [PATCH] Simplify null checking for canonical URLs in JSON export Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> --- .../Exporting/JsonMessageWriter.cs | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs b/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs index 25420b75..cf3ee38d 100644 --- a/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs @@ -139,11 +139,8 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) ) ); - // Include canonical URL if a proxy URL is being used - if ( - !string.IsNullOrWhiteSpace(embedAuthor.IconProxyUrl) - && !string.IsNullOrWhiteSpace(embedAuthor.IconUrl) - ) + // Include canonical URL if present + if (!string.IsNullOrWhiteSpace(embedAuthor.IconUrl)) { _writer.WriteString("iconCanonicalUrl", embedAuthor.IconUrl); } @@ -170,11 +167,8 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) ) ); - // Include canonical URL if a proxy URL is being used - if ( - !string.IsNullOrWhiteSpace(embedImage.ProxyUrl) - && !string.IsNullOrWhiteSpace(embedImage.Url) - ) + // Include canonical URL if present + if (!string.IsNullOrWhiteSpace(embedImage.Url)) { _writer.WriteString("canonicalUrl", embedImage.Url); } @@ -204,11 +198,8 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) ) ); - // Include canonical URL if a proxy URL is being used - if ( - !string.IsNullOrWhiteSpace(embedVideo.ProxyUrl) - && !string.IsNullOrWhiteSpace(embedVideo.Url) - ) + // Include canonical URL if present + if (!string.IsNullOrWhiteSpace(embedVideo.Url)) { _writer.WriteString("canonicalUrl", embedVideo.Url); } @@ -240,11 +231,8 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) ) ); - // Include canonical URL if a proxy URL is being used - if ( - !string.IsNullOrWhiteSpace(embedFooter.IconProxyUrl) - && !string.IsNullOrWhiteSpace(embedFooter.IconUrl) - ) + // Include canonical URL if present + if (!string.IsNullOrWhiteSpace(embedFooter.IconUrl)) { _writer.WriteString("iconCanonicalUrl", embedFooter.IconUrl); }