Skip to content

Commit 21a8f6c

Browse files
committed
No comment
1 parent a50dedc commit 21a8f6c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

OsmGursBuildingImport/Program.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.IO;
55
using System.IO.Compression;
66
using System.Linq;
7+
using System.Net.Http.Json;
78
using System.Text.RegularExpressions;
89
using System.Threading.Tasks;
910
using ICSharpCode.SharpZipLib.BZip2;
@@ -173,10 +174,16 @@ static async Task<int> Process(string[] args, CancellationToken cancellationToke
173174
return null;
174175
}
175176

177+
class RedirectJson
178+
{
179+
public string? url { get; set; }
180+
}
181+
176182
private static async Task DownloadFileAsync(string url, string filePath)
177183
{
178184
var http = new HttpClient();
179-
using var stream = await http.GetStreamAsync(url);
185+
var redirectJson = await http.GetFromJsonAsync<RedirectJson>(url);
186+
using var stream = await http.GetStreamAsync(redirectJson.url);
180187
using var fileStream = new FileStream(filePath, FileMode.Create);
181188
await stream.CopyToAsync(fileStream);
182189
}

0 commit comments

Comments
 (0)