Simplify null checking for canonical URLs in JSON export

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-31 16:43:03 +00:00
parent 5a12e42f45
commit 197c9f39e3

View file

@ -139,11 +139,8 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
) )
); );
// Include canonical URL if a proxy URL is being used // Include canonical URL if present
if ( if (!string.IsNullOrWhiteSpace(embedAuthor.IconUrl))
!string.IsNullOrWhiteSpace(embedAuthor.IconProxyUrl)
&& !string.IsNullOrWhiteSpace(embedAuthor.IconUrl)
)
{ {
_writer.WriteString("iconCanonicalUrl", 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 // Include canonical URL if present
if ( if (!string.IsNullOrWhiteSpace(embedImage.Url))
!string.IsNullOrWhiteSpace(embedImage.ProxyUrl)
&& !string.IsNullOrWhiteSpace(embedImage.Url)
)
{ {
_writer.WriteString("canonicalUrl", 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 // Include canonical URL if present
if ( if (!string.IsNullOrWhiteSpace(embedVideo.Url))
!string.IsNullOrWhiteSpace(embedVideo.ProxyUrl)
&& !string.IsNullOrWhiteSpace(embedVideo.Url)
)
{ {
_writer.WriteString("canonicalUrl", 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 // Include canonical URL if present
if ( if (!string.IsNullOrWhiteSpace(embedFooter.IconUrl))
!string.IsNullOrWhiteSpace(embedFooter.IconProxyUrl)
&& !string.IsNullOrWhiteSpace(embedFooter.IconUrl)
)
{ {
_writer.WriteString("iconCanonicalUrl", embedFooter.IconUrl); _writer.WriteString("iconCanonicalUrl", embedFooter.IconUrl);
} }