diff --git a/eng/Versions.props b/eng/Versions.props index d1fd5f78483..f98aacca15b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -2,10 +2,10 @@ - 17.14.7release + 17.14.8release 17.13.9 15.1.0.0 - preview + servicing true true diff --git a/src/Tasks/DownloadFile.cs b/src/Tasks/DownloadFile.cs index 71dc72e4c91..8c311f45624 100644 --- a/src/Tasks/DownloadFile.cs +++ b/src/Tasks/DownloadFile.cs @@ -169,7 +169,7 @@ private async Task DownloadAsync(Uri uri, CancellationToken cancellationToken) #endif } - if (!TryGetFileName(response, out string filename)) + if (!TryGetFileName(uri, out string filename)) { Log.LogErrorWithCodeFromResources("DownloadFile.ErrorUnknownFileName", SourceUrl, nameof(DestinationFileName)); return; @@ -308,25 +308,24 @@ private static bool IsRetriable(Exception exception, out Exception actualExcepti /// /// Attempts to get the file name to use when downloading the file. /// - /// The with information about the response. + /// The uri we sent request to. /// Receives the name of the file. /// true if a file name could be determined, otherwise false. - private bool TryGetFileName(HttpResponseMessage response, out string filename) + private bool TryGetFileName(Uri requestUri, out string filename) { - if (response == null) + if (requestUri == null) { - throw new ArgumentNullException(nameof(response)); + throw new ArgumentNullException(nameof(requestUri)); } // Not all URIs contain a file name so users will have to specify one // Example: http://www.download.com/file/1/ - filename = !String.IsNullOrWhiteSpace(DestinationFileName?.ItemSpec) + filename = !string.IsNullOrWhiteSpace(DestinationFileName?.ItemSpec) ? DestinationFileName.ItemSpec // Get the file name from what the user specified - : response.Content?.Headers?.ContentDisposition?.FileName // Attempt to get the file name from the content-disposition header value - ?? Path.GetFileName(response.RequestMessage.RequestUri.LocalPath); // Otherwise attempt to get a file name from the URI + : Path.GetFileName(requestUri.LocalPath); // Otherwise attempt to get a file name from the URI - return !String.IsNullOrWhiteSpace(filename); + return !string.IsNullOrWhiteSpace(filename); } #if !NET6_0_OR_GREATER