mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-06-15 11:56:51 +00:00
Fix data-canonical-url and improve test specificity
- Use canonical (non-proxy) URL for data-canonical-url attribute - Extract thumbnailUrl to local variable to avoid duplicate calls - Update test to check for img with video ID in src, avoiding false positives - Test now verifies the actual thumbnail data rather than any link Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
@@ -427,7 +427,11 @@
|
||||
@* Video thumbnail *@
|
||||
<div class="chatlog__embed-youtube-container">
|
||||
<a href="@youTubeVideoEmbed.Url">
|
||||
<img class="chatlog__embed-youtube-thumbnail" src="@await ResolveAssetUrlAsync(youTubeVideoEmbed.GetThumbnailUrl(embed))" alt="YouTube video thumbnail" loading="lazy" onerror="this.style.visibility='hidden'" data-canonical-url="@youTubeVideoEmbed.GetThumbnailUrl(embed)">
|
||||
@{
|
||||
var thumbnailUrl = youTubeVideoEmbed.GetThumbnailUrl(embed);
|
||||
var thumbnailCanonicalUrl = embed.Thumbnail?.Url ?? youTubeVideoEmbed.ThumbnailUrl;
|
||||
}
|
||||
<img class="chatlog__embed-youtube-thumbnail" src="@await ResolveAssetUrlAsync(thumbnailUrl)" alt="YouTube video thumbnail" loading="lazy" onerror="this.style.visibility='hidden'" data-canonical-url="@thumbnailCanonicalUrl">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user