feat(525): render path no longer fetches a URL logo; degrades to no bug
This commit is contained in:
@@ -72,10 +72,15 @@ public class WatermarkSelectorChannelLogoTests
|
||||
return channel;
|
||||
}
|
||||
|
||||
// ---- external URL logo: the #502 defect ----------------------------------------------------
|
||||
// ---- external URL logo: render path must degrade to no bug, never fetch (#525) --------------
|
||||
//
|
||||
// As of #525 an external-URL logo is downloaded and cached at save time, so a URL path can only be a
|
||||
// row that failed migration. The render/watermark path must NOT fetch at compositing time: it degrades
|
||||
// to None (no on-screen bug) with a warning, rather than handing the URL downstream as a renderable
|
||||
// ImagePath (the #502 behavior these tests previously pinned).
|
||||
|
||||
[Test]
|
||||
public void PlayoutItemWatermark_Should_Use_External_Url_Channel_Logo()
|
||||
public void PlayoutItemWatermark_Should_Ignore_External_Url_Channel_Logo()
|
||||
{
|
||||
ChannelWatermark watermark = ChannelLogoWatermark(1, "PlayoutItem");
|
||||
Channel channel = ChannelWithLogo(ExternalLogoUrl);
|
||||
@@ -85,14 +90,11 @@ public class WatermarkSelectorChannelLogoTests
|
||||
watermark,
|
||||
Option<ChannelWatermark>.None);
|
||||
|
||||
result.IsSome.ShouldBeTrue();
|
||||
WatermarkOptions options = result.IfNone(() => throw new InvalidOperationException());
|
||||
options.ImagePath.ShouldBe(ExternalLogoUrl);
|
||||
options.Watermark.ShouldBe(watermark);
|
||||
result.IsNone.ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ChannelWatermark_Should_Use_External_Url_Channel_Logo()
|
||||
public void ChannelWatermark_Should_Ignore_External_Url_Channel_Logo()
|
||||
{
|
||||
ChannelWatermark watermark = ChannelLogoWatermark(2, "Channel");
|
||||
Channel channel = ChannelWithLogo(ExternalLogoUrl, watermark);
|
||||
@@ -102,14 +104,13 @@ public class WatermarkSelectorChannelLogoTests
|
||||
Option<ChannelWatermark>.None,
|
||||
Option<ChannelWatermark>.None);
|
||||
|
||||
result.IsSome.ShouldBeTrue();
|
||||
WatermarkOptions options = result.IfNone(() => throw new InvalidOperationException());
|
||||
options.ImagePath.ShouldBe(ExternalLogoUrl);
|
||||
options.Watermark.ShouldBe(watermark);
|
||||
result.IsNone.ShouldBeTrue();
|
||||
// never hand the URL downstream as a renderable path
|
||||
result.IfSome(o => o.ImagePath.ShouldNotBe(ExternalLogoUrl));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GlobalWatermark_Should_Use_External_Url_Channel_Logo()
|
||||
public void GlobalWatermark_Should_Ignore_External_Url_Channel_Logo()
|
||||
{
|
||||
ChannelWatermark watermark = ChannelLogoWatermark(3, "Global");
|
||||
Channel channel = ChannelWithLogo(ExternalLogoUrl);
|
||||
@@ -119,10 +120,7 @@ public class WatermarkSelectorChannelLogoTests
|
||||
Option<ChannelWatermark>.None,
|
||||
watermark);
|
||||
|
||||
result.IsSome.ShouldBeTrue();
|
||||
WatermarkOptions options = result.IfNone(() => throw new InvalidOperationException());
|
||||
options.ImagePath.ShouldBe(ExternalLogoUrl);
|
||||
options.Watermark.ShouldBe(watermark);
|
||||
result.IsNone.ShouldBeTrue();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -131,7 +129,7 @@ public class WatermarkSelectorChannelLogoTests
|
||||
/// existence-gated branch and re-introduce the defect for an oddly-cased URL.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void ChannelWatermark_Should_Use_External_Url_Channel_Logo_Regardless_Of_Scheme_Case()
|
||||
public void ChannelWatermark_Should_Ignore_External_Url_Channel_Logo_Regardless_Of_Scheme_Case()
|
||||
{
|
||||
const string UpperCaseUrl = "HTTPS://cdn.example.com/logos/channel.png";
|
||||
ChannelWatermark watermark = ChannelLogoWatermark(2, "Channel");
|
||||
@@ -142,8 +140,7 @@ public class WatermarkSelectorChannelLogoTests
|
||||
Option<ChannelWatermark>.None,
|
||||
Option<ChannelWatermark>.None);
|
||||
|
||||
result.IsSome.ShouldBeTrue();
|
||||
result.IfNone(() => throw new InvalidOperationException()).ImagePath.ShouldBe(UpperCaseUrl);
|
||||
result.IsNone.ShouldBeTrue();
|
||||
}
|
||||
|
||||
// ---- regressions: local-file behavior must not change ---------------------------------------
|
||||
|
||||
@@ -292,11 +292,11 @@ public class WatermarkSelector(
|
||||
/// shared by the playout-item, channel and global precedence levels so all three agree.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// An external-URL logo has no local file, so it must not be existence-checked: the branding tab
|
||||
/// advertises the URL as winning, but <c>File.Exists("https://…")</c> is always false, which silently
|
||||
/// dropped the bug for every such channel (#502). External URLs are handed downstream as-is, matching
|
||||
/// how every other consumer treats external artwork (M3U, XMLTV, SPA JSON all emit the raw URL);
|
||||
/// <c>ImageElementBase.LoadImage</c> fetches it over http when compositing.
|
||||
/// As of #525 an external-URL logo is downloaded and cached at save time, so a URL path here can only
|
||||
/// be a row that failed migration. The render path must never fetch at compositing time, so such a row
|
||||
/// degrades to no watermark (no on-screen bug) with a warning rather than being handed downstream as a
|
||||
/// renderable URL (the #502 behavior). Other consumers (M3U, XMLTV, SPA JSON) still emit the raw URL for
|
||||
/// a not-yet-migrated row; only this render/watermark path changed.
|
||||
/// </remarks>
|
||||
private Option<WatermarkOptions> ChannelLogoWatermarkOptions(Channel channel, ChannelWatermark watermark)
|
||||
{
|
||||
@@ -304,7 +304,14 @@ public class WatermarkSelector(
|
||||
{
|
||||
if (Artwork.IsExternalUrl(logoArtwork.Path))
|
||||
{
|
||||
return new WatermarkOptions(watermark, logoArtwork.Path, None);
|
||||
// As of #525 an external-URL logo is downloaded and cached at save time, so a URL here
|
||||
// means a row that failed migration. Do not fetch at render time; degrade to no bug.
|
||||
logger.LogWarning(
|
||||
"Channel logo for channel {Channel} is still an un-downloaded URL {Url}; re-save the "
|
||||
+ "channel to download it. Rendering without an on-screen bug.",
|
||||
channel.Number,
|
||||
logoArtwork.Path);
|
||||
return None;
|
||||
}
|
||||
|
||||
string cachedPath = imageCache.GetPathForImage(logoArtwork.Path, ArtworkKind.Logo, Option<int>.None);
|
||||
|
||||
Reference in New Issue
Block a user