diff --git a/Netkan/Services/CachingHttpService.cs b/Netkan/Services/CachingHttpService.cs index 1ec7f5b804..33267cfdee 100644 --- a/Netkan/Services/CachingHttpService.cs +++ b/Netkan/Services/CachingHttpService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using log4net; using CKAN.NetKAN.Model; @@ -88,7 +89,8 @@ private string DownloadPackage(Uri url, string identifier, DateTime? updated, Ur string invalidReason; if (!NetFileCache.ZipValid(downloadedFile, out invalidReason)) { - log.Debug($"{downloadedFile} is not a valid ZIP file: {invalidReason}"); + log.Debug($"{url} is not a valid ZIP file: {invalidReason}"); + File.Delete(downloadedFile); throw new Kraken($"{url} is not a valid ZIP file: {invalidReason}"); } break; @@ -114,7 +116,7 @@ public string DownloadText(Uri url, string authToken, string mimeType = null) { return TryGetCached(url, () => Net.DownloadText(url, authToken, mimeType)); } - + private string TryGetCached(Uri url, Func uncached) { if (_stringCache.TryGetValue(url, out StringCacheEntry entry)) @@ -153,5 +155,5 @@ public class StringCacheEntry public string Value; public DateTime Timestamp; } - + } diff --git a/Netkan/Transformers/NetkanTransformer.cs b/Netkan/Transformers/NetkanTransformer.cs index e2538132a0..a0f2cbbc31 100644 --- a/Netkan/Transformers/NetkanTransformer.cs +++ b/Netkan/Transformers/NetkanTransformer.cs @@ -47,7 +47,7 @@ IValidator validator new VersionEditTransformer(), new ForcedVTransformer(), new EpochTransformer(), - // This is the "default" VersionedOverrideTransformer for compatability with overrides that don't + // This is the "default" VersionedOverrideTransformer for compatibility with overrides that don't // specify a before or after property. new VersionedOverrideTransformer(before: new string[] { null }, after: new string[] { null }), new DownloadAttributeTransformer(http, fileService),