Add FollowRedirects option to downloader
Introduces a FollowRedirects property to UnitDownloaderOptions and its builder, allowing control over HTTP redirect behavior. Updates UnitDownloader to use this option, following redirects when enabled and reporting progress accordingly.
This commit is contained in:
@@ -24,6 +24,8 @@ public record class UnitDownloaderOptions<OutType> {
|
||||
public string? DownloadFolder { get; init; } = null;
|
||||
public int BufferSize { get; init; } = 80 * 1024; // 80kb
|
||||
|
||||
public bool FollowRedirects { get; init; } = true;
|
||||
|
||||
public string GetFileNameForDownload(string url, byte[] additionalData) {
|
||||
byte[] bytes = [..Encoding.UTF8.GetBytes(url), ..additionalData];
|
||||
var name = Convert.ToBase64String(System.IO.Hashing.XxHash64.Hash(bytes));
|
||||
|
||||
Reference in New Issue
Block a user