From 8acd6a2868c25064e021969b4d362195b32803b1 Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Fri, 9 Dec 2016 08:09:58 +0000 Subject: [PATCH] Fixed #748 --- .../Migrations/Version1100.cs | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/PlexRequests.Core.Migration/Migrations/Version1100.cs b/PlexRequests.Core.Migration/Migrations/Version1100.cs index 012bcd126..7e23cbdbe 100644 --- a/PlexRequests.Core.Migration/Migrations/Version1100.cs +++ b/PlexRequests.Core.Migration/Migrations/Version1100.cs @@ -238,18 +238,22 @@ namespace PlexRequests.Core.Migration.Migrations // UI = https://image.tmdb.org/t/p/w150/{{posterPath}} // Update old invalid posters - // var allRequests = RequestService.GetAll().ToList(); - - // foreach (var req in allRequests) - // { - // if (req.PosterPath.Contains("https://image.tmdb.org/t/p/w150/")) - // { - // var newImg = req.PosterPath.Replace("https://image.tmdb.org/t/p/w150/", string.Empty); - // req.PosterPath = newImg; - // } - // } - // RequestService.BatchUpdate(allRequests); - } + var allRequests = RequestService.GetAll(); + if (allRequests == null) + { + return; + } + var requestedModels = allRequests as RequestedModel[] ?? allRequests.ToArray(); + foreach (var req in requestedModels) + { + if (req.PosterPath.Contains("https://image.tmdb.org/t/p/w150/")) + { + var newImg = req.PosterPath.Replace("https://image.tmdb.org/t/p/w150/", string.Empty); + req.PosterPath = newImg; + } + } + RequestService.BatchUpdate(requestedModels); + } private void UpdateAdmin() {