From 48c86369a6bdcf2b57ba320eab88782afda59585 Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Tue, 29 May 2018 13:20:53 +0100 Subject: [PATCH] Fixed #2013 --- .../ClientApp/app/issues/issueDetails.component.ts | 6 ++++-- .../app/recentlyAdded/recentlyAdded.component.ts | 8 ++++++-- .../ClientApp/app/requests/tvrequests.component.ts | 4 +++- src/Ombi/ClientApp/app/search/tvsearch.component.ts | 8 +++++--- src/Ombi/Controllers/ImagesController.cs | 12 ++++++++++++ 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/Ombi/ClientApp/app/issues/issueDetails.component.ts b/src/Ombi/ClientApp/app/issues/issueDetails.component.ts index 38adbe390..a00f4e89b 100644 --- a/src/Ombi/ClientApp/app/issues/issueDetails.component.ts +++ b/src/Ombi/ClientApp/app/issues/issueDetails.component.ts @@ -117,8 +117,10 @@ export class IssueDetailsComponent implements OnInit { } else { this.imageService.getTvBackground(Number(issue.providerId)).subscribe(x => { - this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle - ("url(" + x + ")"); + if(x) { + this.backgroundPath = this.sanitizer.bypassSecurityTrustStyle + ("url(" + x + ")"); + } }); this.imageService.getTvPoster(Number(issue.providerId)).subscribe(x => { if (x.length === 0) { diff --git a/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts b/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts index 53d652070..2d5ec2bd6 100644 --- a/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts +++ b/src/Ombi/ClientApp/app/recentlyAdded/recentlyAdded.component.ts @@ -88,7 +88,9 @@ export class RecentlyAddedComponent implements OnInit { this.tv.forEach((t) => { this.imageService.getTvPoster(t.tvDbId).subscribe(p => { - t.posterPath = p; + if(p) { + t.posterPath = p; + } }); }); }); @@ -98,7 +100,9 @@ export class RecentlyAddedComponent implements OnInit { this.tv.forEach((t) => { this.imageService.getTvPoster(t.tvDbId).subscribe(p => { - t.posterPath = p; + if(p) { + t.posterPath = p; + } }); }); }); diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index 10b1b750e..202b6dbf6 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -240,8 +240,10 @@ export class TvRequestsComponent implements OnInit { ("url(https://image.tmdb.org/t/p/w1280" + val.data.background + ")"); } else { this.imageService.getTvBanner(val.data.tvDbId).subscribe(x => { - val.data.background = this.sanitizer.bypassSecurityTrustStyle + if(x) { + val.data.background = this.sanitizer.bypassSecurityTrustStyle ("url(" + x + ")"); + } }); } } diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.ts b/src/Ombi/ClientApp/app/search/tvsearch.component.ts index cdb3e1c6e..8db75125c 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.ts +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.ts @@ -138,9 +138,11 @@ export class TvSearchComponent implements OnInit { public getExtraInfo() { this.tvResults.forEach((val, index) => { this.imageService.getTvBanner(val.data.id).subscribe(x => { - val.data.background = this.sanitizer. - bypassSecurityTrustStyle - ("url(" + x + ")"); + if(x) { + val.data.background = this.sanitizer. + bypassSecurityTrustStyle + ("url(" + x + ")"); + } }); this.searchService.getShowInformationTreeNode(val.data.id) .subscribe(x => { diff --git a/src/Ombi/Controllers/ImagesController.cs b/src/Ombi/Controllers/ImagesController.cs index 692966258..69ec9e328 100644 --- a/src/Ombi/Controllers/ImagesController.cs +++ b/src/Ombi/Controllers/ImagesController.cs @@ -35,6 +35,10 @@ namespace Ombi.Controllers [HttpGet("tv/{tvdbid}")] public async Task GetTvBanner(int tvdbid) { + if (tvdbid <= 0) + { + return string.Empty; + } var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1)); var images = await FanartTvApi.GetTvImages(tvdbid, key.Value); @@ -90,6 +94,10 @@ namespace Ombi.Controllers [HttpGet("poster/tv/{tvdbid}")] public async Task GetTvPoster(int tvdbid) { + if (tvdbid <= 0) + { + return string.Empty; + } var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1)); var images = await FanartTvApi.GetTvImages(tvdbid, key.Value); @@ -145,6 +153,10 @@ namespace Ombi.Controllers [HttpGet("background/tv/{tvdbid}")] public async Task GetTvBackground(int tvdbid) { + if (tvdbid <= 0) + { + return string.Empty; + } var key = await _cache.GetOrAdd(CacheKeys.FanartTv, async () => await Config.Get(Store.Entities.ConfigurationTypes.FanartTv), DateTime.Now.AddDays(1)); var images = await FanartTvApi.GetTvImages(tvdbid, key.Value);