From 11041ef1e95f8cf55dfc21521636aaf687e4fb2f Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Tue, 16 Nov 2021 16:31:58 -0800 Subject: [PATCH] Dynamically maps outdated artwork URLs to correct URLs --- Delta/Database/Model/Human/Game.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Delta/Database/Model/Human/Game.swift b/Delta/Database/Model/Human/Game.swift index 3cb5c1e..18987cd 100644 --- a/Delta/Database/Model/Human/Game.swift +++ b/Delta/Database/Model/Human/Game.swift @@ -45,12 +45,16 @@ public class Game: _Game, GameProtocol // Recreate the stored URL relative to current sandbox location. artworkURL = URL(fileURLWithPath: unwrappedArtworkURL.relativePath, relativeTo: DatabaseManager.gamesDirectoryURL) } - else if unwrappedArtworkURL.host?.lowercased() == "img.gamefaqs.net", var components = URLComponents(url: unwrappedArtworkURL, resolvingAgainstBaseURL: false) + else if let host = unwrappedArtworkURL.host?.lowercased(), host == "img.gamefaqs.net" || host == "gamefaqs1.cbsistatic.com", + var components = URLComponents(url: unwrappedArtworkURL, resolvingAgainstBaseURL: false) { // Quick fix for broken album artwork URLs due to host change. - components.host = "gamefaqs1.cbsistatic.com" + components.host = "gamefaqs.gamespot.com" components.scheme = "https" + let updatedPath = "/a" + components.path + components.path = updatedPath + if let url = components.url { artworkURL = url