-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Why does DownloadAsync (by filename) .... download the whole file TWICE?
If you look at the code there are two "DownloadFileByNameAsync" calls, both will do the full transfer (with 100K) file.
Was the intent just to get a "HEAD" to get the length?
public async Task<IApiResults<DownloadFileResponse>> DownloadAsync
(DownloadFileByNameRequest request, Stream content, IProgress<ICopyProgress> progress, CancellationToken cancel)
{
return await _policy.InvokeDownload.ExecuteAsync(async () =>
{
var fileRequest = new DownloadFileByNameRequest(request.BucketName, request.FileName);
var fileResults = await DownloadFileByNameAsync(fileRequest, null, null, cancel);
if (fileResults.IsSuccessStatusCode)
{
if (fileResults.Response.ContentLength < Options.DownloadCutoffSize)
{
return await DownloadFileByNameAsync(request, content, progress, cancel).ConfigureAwait(false);
}
else
{
return await DownloadLargeFileAsync(fileRequest, fileResults, content, progress, cancel).ConfigureAwait(false);
}
}
return fileResults;
}).ConfigureAwait(false);
}
damian-krychowski
Metadata
Metadata
Assignees
Labels
No labels