Skip to content

Commit

Permalink
Fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszCichecki committed Aug 7, 2024
1 parent 8ada637 commit c1b4b37
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -63,10 +62,10 @@ private static async Task TryValidateChecksum(Package package, string tempPath,
return;
}
}
catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.NotFound)
catch (HttpRequestException ex)
{
if (Log.Instance.IsTraceEnabled)
Log.Instance.Trace($"External file checksum not found. [fileName={package.FileName}, fileLocation={package.FileLocation}, fileCrc={package.FileCrc}]");
Log.Instance.Trace($"External file checksum not found. [statusCode={ex.StatusCode}, fileName={package.FileName}, fileLocation={package.FileLocation}, fileCrc={package.FileCrc}]");
}

if (Log.Instance.IsTraceEnabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public override async Task<List<Package>> GetPackagesAsync(string machineType, O
return null;

var fileLocation = mainFileNode["URL"]!.ToString();
var fileName = fileLocation[(fileLocation.LastIndexOf('/') + 1)..];
var fileName = new Uri(fileLocation).Segments.LastOrDefault("file");// fileLocation[(fileLocation.LastIndexOf('/') + 1)..];
var fileSize = mainFileNode["Size"]!.ToString();
var fileCrc = mainFileNode["SHA256"]?.ToString();
var releaseDateUnix = long.Parse(mainFileNode["Date"]!["Unix"]!.ToString());
Expand Down

0 comments on commit c1b4b37

Please sign in to comment.