Remove conditional checks for canonical URLs in HTML and JSON exports

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-31 16:50:20 +00:00
parent 197c9f39e3
commit 27c0d60812
2 changed files with 15 additions and 39 deletions

View file

@ -138,13 +138,8 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
cancellationToken
)
);
// Include canonical URL if present
if (!string.IsNullOrWhiteSpace(embedAuthor.IconUrl))
{
_writer.WriteString("iconCanonicalUrl", embedAuthor.IconUrl);
}
}
_writer.WriteEndObject();
await _writer.FlushAsync(cancellationToken);
@ -166,13 +161,8 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
cancellationToken
)
);
// Include canonical URL if present
if (!string.IsNullOrWhiteSpace(embedImage.Url))
{
_writer.WriteString("canonicalUrl", embedImage.Url);
}
}
_writer.WriteNumber("width", embedImage.Width);
_writer.WriteNumber("height", embedImage.Height);
@ -197,13 +187,8 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
cancellationToken
)
);
// Include canonical URL if present
if (!string.IsNullOrWhiteSpace(embedVideo.Url))
{
_writer.WriteString("canonicalUrl", embedVideo.Url);
}
}
_writer.WriteNumber("width", embedVideo.Width);
_writer.WriteNumber("height", embedVideo.Height);
@ -230,13 +215,8 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
cancellationToken
)
);
// Include canonical URL if present
if (!string.IsNullOrWhiteSpace(embedFooter.IconUrl))
{
_writer.WriteString("iconCanonicalUrl", embedFooter.IconUrl);
}
}
_writer.WriteEndObject();
await _writer.FlushAsync(cancellationToken);

View file

@ -388,7 +388,7 @@
<div class="chatlog__embed-author-container">
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
{
<img class="chatlog__embed-author-icon" src="@await ResolveAssetUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'" @(embed.Author.IconProxyUrl is not null && embed.Author.IconUrl is not null ? $"data-canonical-url=\"{embed.Author.IconUrl}\"" : null)>
<img class="chatlog__embed-author-icon" src="@await ResolveAssetUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'" data-canonical-url="@embed.Author.IconUrl">
}
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
@ -442,13 +442,11 @@
embed.Url;
var embedImageCanonicalUrl =
(embed.Image?.ProxyUrl is not null && embed.Image?.Url is not null) ? embed.Image?.Url :
(embed.Thumbnail?.ProxyUrl is not null && embed.Thumbnail?.Url is not null) ? embed.Thumbnail?.Url :
null;
embed.Image?.Url ?? embed.Thumbnail?.Url ?? embed.Url;
<div class="chatlog__embed">
<a href="@await ResolveAssetUrlAsync(embedImageUrl)">
<img class="chatlog__embed-generic-image" src="@await ResolveAssetUrlAsync(embedImageUrl)" alt="Embedded image" loading="lazy" @(embedImageCanonicalUrl is not null ? $"data-canonical-url=\"{embedImageCanonicalUrl}\"" : null)>
<img class="chatlog__embed-generic-image" src="@await ResolveAssetUrlAsync(embedImageUrl)" alt="Embedded image" loading="lazy" data-canonical-url="@embedImageCanonicalUrl">
</a>
</div>
}
@ -462,11 +460,10 @@
embed.Video?.ProxyUrl ?? embed.Video?.Url ??
embed.Url;
var embedVideoCanonicalUrl =
embed.Video?.ProxyUrl is not null && embed.Video?.Url is not null ? embed.Video?.Url : null;
var embedVideoCanonicalUrl = embed.Video?.Url ?? embed.Url;
<div class="chatlog__embed">
<video class="chatlog__embed-generic-video" width="@embed.Video?.Width" height="@embed.Video?.Height" controls @(embedVideoCanonicalUrl is not null ? $"data-canonical-url=\"{embedVideoCanonicalUrl}\"" : null)>
<video class="chatlog__embed-generic-video" width="@embed.Video?.Width" height="@embed.Video?.Height" controls data-canonical-url="@embedVideoCanonicalUrl">
<source src="@await ResolveAssetUrlAsync(embedVideoUrl)" alt="Embedded video">
</video>
</div>
@ -478,11 +475,10 @@
embed.Video?.ProxyUrl ?? embed.Video?.Url ??
embed.Url;
var embedVideoCanonicalUrl =
embed.Video?.ProxyUrl is not null && embed.Video?.Url is not null ? embed.Video?.Url : null;
var embedVideoCanonicalUrl = embed.Video?.Url ?? embed.Url;
<div class="chatlog__embed">
<video class="chatlog__embed-generic-gifv" width="@embed.Video?.Width" height="@embed.Video?.Height" loop onmouseover="this.play()" onmouseout="this.pause()" @(embedVideoCanonicalUrl is not null ? $"data-canonical-url=\"{embedVideoCanonicalUrl}\"" : null)>
<video class="chatlog__embed-generic-gifv" width="@embed.Video?.Width" height="@embed.Video?.Height" loop onmouseover="this.play()" onmouseout="this.pause()" data-canonical-url="@embedVideoCanonicalUrl">
<source src="@await ResolveAssetUrlAsync(embedVideoUrl)" alt="Embedded gifv">
</video>
</div>
@ -510,7 +506,7 @@
<div class="chatlog__embed-author-container">
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
{
<img class="chatlog__embed-author-icon" src="@await ResolveAssetUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'" @(embed.Author.IconProxyUrl is not null && embed.Author.IconUrl is not null ? $"data-canonical-url=\"{embed.Author.IconUrl}\"" : null)>
<img class="chatlog__embed-author-icon" src="@await ResolveAssetUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'" data-canonical-url="@embed.Author.IconUrl">
}
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
@ -585,7 +581,7 @@
{
<div class="chatlog__embed-thumbnail-container">
<a class="chatlog__embed-thumbnail-link" href="@await ResolveAssetUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)">
<img class="chatlog__embed-thumbnail" src="@await ResolveAssetUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)" alt="Thumbnail" loading="lazy" @(embed.Thumbnail.ProxyUrl is not null && embed.Thumbnail.Url is not null ? $"data-canonical-url=\"{embed.Thumbnail.Url}\"" : null)>
<img class="chatlog__embed-thumbnail" src="@await ResolveAssetUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)" alt="Thumbnail" loading="lazy" data-canonical-url="@embed.Thumbnail.Url">
</a>
</div>
}
@ -601,7 +597,7 @@
{
<div class="chatlog__embed-image-container">
<a class="chatlog__embed-image-link" href="@await ResolveAssetUrlAsync(image.ProxyUrl ?? image.Url)">
<img class="chatlog__embed-image" src="@await ResolveAssetUrlAsync(image.ProxyUrl ?? image.Url)" alt="Image" loading="lazy" @(image.ProxyUrl is not null && image.Url is not null ? $"data-canonical-url=\"{image.Url}\"" : null)>
<img class="chatlog__embed-image" src="@await ResolveAssetUrlAsync(image.ProxyUrl ?? image.Url)" alt="Image" loading="lazy" data-canonical-url="@image.Url">
</a>
</div>
}
@ -616,7 +612,7 @@
@* Footer icon *@
@if (!string.IsNullOrWhiteSpace(embed.Footer?.IconUrl))
{
<img class="chatlog__embed-footer-icon" src="@await ResolveAssetUrlAsync(embed.Footer.IconProxyUrl ?? embed.Footer.IconUrl)" alt="Footer icon" loading="lazy" @(embed.Footer.IconProxyUrl is not null && embed.Footer.IconUrl is not null ? $"data-canonical-url=\"{embed.Footer.IconUrl}\"" : null)>
<img class="chatlog__embed-footer-icon" src="@await ResolveAssetUrlAsync(embed.Footer.IconProxyUrl ?? embed.Footer.IconUrl)" alt="Footer icon" loading="lazy" data-canonical-url="@embed.Footer.IconUrl">
}
<span class="chatlog__embed-footer-text">