diff --git a/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs b/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs index 2ffa4364..25420b75 100644 --- a/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/JsonMessageWriter.cs @@ -140,7 +140,10 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) ); // Include canonical URL if a proxy URL is being used - if (!string.IsNullOrWhiteSpace(embedAuthor.IconProxyUrl)) + if ( + !string.IsNullOrWhiteSpace(embedAuthor.IconProxyUrl) + && !string.IsNullOrWhiteSpace(embedAuthor.IconUrl) + ) { _writer.WriteString("iconCanonicalUrl", embedAuthor.IconUrl); } @@ -168,7 +171,10 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) ); // Include canonical URL if a proxy URL is being used - if (!string.IsNullOrWhiteSpace(embedImage.ProxyUrl)) + if ( + !string.IsNullOrWhiteSpace(embedImage.ProxyUrl) + && !string.IsNullOrWhiteSpace(embedImage.Url) + ) { _writer.WriteString("canonicalUrl", embedImage.Url); } @@ -199,7 +205,10 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) ); // Include canonical URL if a proxy URL is being used - if (!string.IsNullOrWhiteSpace(embedVideo.ProxyUrl)) + if ( + !string.IsNullOrWhiteSpace(embedVideo.ProxyUrl) + && !string.IsNullOrWhiteSpace(embedVideo.Url) + ) { _writer.WriteString("canonicalUrl", embedVideo.Url); } @@ -232,7 +241,10 @@ internal class JsonMessageWriter(Stream stream, ExportContext context) ); // Include canonical URL if a proxy URL is being used - if (!string.IsNullOrWhiteSpace(embedFooter.IconProxyUrl)) + if ( + !string.IsNullOrWhiteSpace(embedFooter.IconProxyUrl) + && !string.IsNullOrWhiteSpace(embedFooter.IconUrl) + ) { _writer.WriteString("iconCanonicalUrl", embedFooter.IconUrl); }