diff --git a/CHANGELOG.md b/CHANGELOG.md index 5438c0d6ce..ce2348372a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file. - [GUI] Mod list fixes and improvements (#3883 by: HebaruSan; reviewed: techman83) - [Multiple] Multi-game labels (#3885 by: HebaruSan; reviewed: techman83) - [Multiple] Alternate mod dirs for validation and manual installs (#3891 by: HebaruSan; reviewed: techman83) +- [Core] Fix archive.org fallback URLs for versions with spaces (#3899 by: HebaruSan) ### Internal diff --git a/Core/Net/NetFileCache.cs b/Core/Net/NetFileCache.cs index 0830a50639..4190552df7 100644 --- a/Core/Net/NetFileCache.cs +++ b/Core/Net/NetFileCache.cs @@ -126,10 +126,10 @@ public string GetInProgressFileName(Uri url, string description) public string GetInProgressFileName(List urls, string description) { - var filenames = urls.Select(url => GetInProgressFileName(NetFileCache.CreateURLHash(url), description)) - .ToArray(); - return filenames.FirstOrDefault(filename => File.Exists(filename)) - ?? filenames.FirstOrDefault(); + var filenames = urls?.Select(url => GetInProgressFileName(NetFileCache.CreateURLHash(url), description)) + .ToArray(); + return filenames?.FirstOrDefault(filename => File.Exists(filename)) + ?? filenames?.FirstOrDefault(); } /// diff --git a/Core/Net/NetModuleCache.cs b/Core/Net/NetModuleCache.cs index 387b905a73..8c0bf0a9c8 100644 --- a/Core/Net/NetModuleCache.cs +++ b/Core/Net/NetModuleCache.cs @@ -94,7 +94,9 @@ public void CheckFreeSpace(long bytesToStore) } public string GetInProgressFileName(CkanModule m) - => cache.GetInProgressFileName(m.download, m.StandardName()); + => m.download == null + ? null + : cache.GetInProgressFileName(m.download, m.StandardName()); private static string DescribeUncachedAvailability(CkanModule m, FileInfo fi) => fi.Exists diff --git a/Core/Types/CkanModule.cs b/Core/Types/CkanModule.cs index 30c975a526..8e2e13bda7 100644 --- a/Core/Types/CkanModule.cs +++ b/Core/Types/CkanModule.cs @@ -784,7 +784,7 @@ public Uri InternetArchiveDownload { get { - string verStr = version.ToString().Replace(':', '-'); + string verStr = version.ToString().Replace(' ', '_').Replace(':', '-'); // Some alternate registry repositories don't set download_hash return (download_hash?.sha1 != null && license.All(l => l.Redistributable)) ? new Uri(