Skip to content

Commit

Permalink
fix UpdateIp2LocationFile
Browse files Browse the repository at this point in the history
  • Loading branch information
trudyhood committed Jul 15, 2024
1 parent 0c53964 commit 14e19d8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Tests/VpnHood.Test/Tests/ClientAppTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private static async Task UpdateIp2LocationFile()
// update current ipLocation in app project after a week
var solutionFolder = TestHelper.GetParentDirectory(Directory.GetCurrentDirectory(), 5);
var ipLocationFile = Path.Combine(solutionFolder, "VpnHood.Client.App", "Resources", "IpLocations.zip");
if (File.GetCreationTime(ipLocationFile) <= DateTime.Now - TimeSpan.FromDays(7))
if (File.GetCreationTime(ipLocationFile) > DateTime.Now - TimeSpan.FromDays(7))
return;

// find token
Expand All @@ -114,8 +114,8 @@ private static async Task UpdateIp2LocationFile()
// copy zip to memory
var httpClient = new HttpClient();
// ReSharper disable once StringLiteralTypo
await using var ipLocationZipNetStream = await httpClient.GetStreamAsync(
$"https://www.ip2location.com/download/?token={ip2LocationToken}&file=DB1LITECSVIPV6");
var url = $"https://www.ip2location.com/download/?token={ip2LocationToken}&file=DB1LITECSVIPV6";
await using var ipLocationZipNetStream = await httpClient.GetStreamAsync(url);
using var ipLocationZipStream = new MemoryStream();
await ipLocationZipNetStream.CopyToAsync(ipLocationZipStream);
ipLocationZipStream.Position = 0;
Expand Down

0 comments on commit 14e19d8

Please sign in to comment.