From 3375ea7bef161bc1cb48be87f8306967519c5b4c Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Wed, 29 Aug 2018 08:19:35 -0500 Subject: [PATCH] cleanup Wayback https convert --- src/FilterLists.Services/Wayback/WaybackService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/FilterLists.Services/Wayback/WaybackService.cs b/src/FilterLists.Services/Wayback/WaybackService.cs index cd028ffc2..2470171fd 100644 --- a/src/FilterLists.Services/Wayback/WaybackService.cs +++ b/src/FilterLists.Services/Wayback/WaybackService.cs @@ -41,10 +41,11 @@ private static async Task GetWaybackAvailability(string url) private static string ParseUrlRaw(Closest closest) { var waybackUrl = closest.Url; - var indexOfUrlModification = waybackUrl.GetNthIndexOfChar(5, '/'); + var waybackUrlHttps = waybackUrl.StartsWith("http:") ? "https" + waybackUrl.Substring(4) : waybackUrl; + var indexOfUrlModification = waybackUrlHttps.GetNthIndexOfChar(5, '/'); const string urlModification = "if_"; - return "https" + waybackUrl.Substring(4, indexOfUrlModification - 4) + urlModification + - waybackUrl.Substring(indexOfUrlModification); + return waybackUrlHttps.Substring(0, indexOfUrlModification) + urlModification + + waybackUrlHttps.Substring(indexOfUrlModification); } private static DateTime ParseTimestampUtc(Closest closest) =>