Skip to content

Commit 12f78aa

Browse files
authored
[vs17.12] Merge tag v17.12.36 (#11864)
Fixes # ### Context ### Changes Made ### Testing ### Notes
2 parents ced3612 + 177ef77 commit 12f78aa

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
33
<Project>
44
<PropertyGroup>
5-
<VersionPrefix>17.12.35</VersionPrefix>
5+
<VersionPrefix>17.12.36</VersionPrefix>
66
<DotNetFinalVersionKind>release</DotNetFinalVersionKind>
77
<PackageValidationBaselineVersion>17.11.4</PackageValidationBaselineVersion>
88
<AssemblyVersion>15.1.0.0</AssemblyVersion>

src/Tasks/DownloadFile.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private async Task DownloadAsync(Uri uri, CancellationToken cancellationToken)
169169
#endif
170170
}
171171

172-
if (!TryGetFileName(response, out string filename))
172+
if (!TryGetFileName(uri, out string filename))
173173
{
174174
Log.LogErrorWithCodeFromResources("DownloadFile.ErrorUnknownFileName", SourceUrl, nameof(DestinationFileName));
175175
return;
@@ -308,25 +308,24 @@ private static bool IsRetriable(Exception exception, out Exception actualExcepti
308308
/// <summary>
309309
/// Attempts to get the file name to use when downloading the file.
310310
/// </summary>
311-
/// <param name="response">The <see cref="HttpResponseMessage"/> with information about the response.</param>
311+
/// <param name="requestUri">The uri we sent request to.</param>
312312
/// <param name="filename">Receives the name of the file.</param>
313313
/// <returns><code>true</code> if a file name could be determined, otherwise <code>false</code>.</returns>
314-
private bool TryGetFileName(HttpResponseMessage response, out string filename)
314+
private bool TryGetFileName(Uri requestUri, out string filename)
315315
{
316-
if (response == null)
316+
if (requestUri == null)
317317
{
318-
throw new ArgumentNullException(nameof(response));
318+
throw new ArgumentNullException(nameof(requestUri));
319319
}
320320

321321
// Not all URIs contain a file name so users will have to specify one
322322
// Example: http://www.download.com/file/1/
323323

324-
filename = !String.IsNullOrWhiteSpace(DestinationFileName?.ItemSpec)
324+
filename = !string.IsNullOrWhiteSpace(DestinationFileName?.ItemSpec)
325325
? DestinationFileName.ItemSpec // Get the file name from what the user specified
326-
: response.Content?.Headers?.ContentDisposition?.FileName // Attempt to get the file name from the content-disposition header value
327-
?? Path.GetFileName(response.RequestMessage.RequestUri.LocalPath); // Otherwise attempt to get a file name from the URI
326+
: Path.GetFileName(requestUri.LocalPath); // Otherwise attempt to get a file name from the URI
328327

329-
return !String.IsNullOrWhiteSpace(filename);
328+
return !string.IsNullOrWhiteSpace(filename);
330329
}
331330

332331
#if !NET6_0_OR_GREATER

0 commit comments

Comments
 (0)