Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/NuGetForUnity/Editor/PackageSource/NugetApiClientV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public NugetApiClientV3([NotNull] string url)

apiIndexJsonUrl = new Uri(url);

#pragma warning disable CA2000 // Dispose objects before losing scope: Ownership is transferred to httpClient
var handler = new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate };
#pragma warning restore CA2000 // Dispose objects before losing scope
if (Application.platform == RuntimePlatform.WindowsEditor)
{
// On Windows, Mono HttpClient does not automatically pick up proxy settings.
Expand Down Expand Up @@ -218,7 +220,7 @@ public async Task DownloadNupkgToFileAsync(

var version = package.Version.ToLowerInvariant();
var id = package.Id.ToLowerInvariant();
downloadUrl = string.Format(packageDownloadUrlTemplate, id, version);
downloadUrl = string.Format(CultureInfo.InvariantCulture, packageDownloadUrlTemplate, id, version);
}

using (var request = new HttpRequestMessage(HttpMethod.Get, downloadUrl))
Expand Down Expand Up @@ -521,6 +523,7 @@ private async Task<List<RegistrationLeafObject>> GetRegistrationPageLeafItems(
$"missing 'items' property inside page request for URL: {itemAtId}, response:\n{registrationPageString}");
}

[SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "We intentionally use lower case.")]
private async Task<List<RegistrationPageObject>> GetRegistrationPageItemsAsync(
NugetPackageSourceV3 packageSource,
INugetPackageIdentifier package,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ await ApiClient.SearchPackageAsync(
var fetchedPackages = await Task.WhenAll(
packagesToFetch.Select(package => ApiClient.GetPackageWithAllVersionsAsync(this, package, CancellationToken.None)))
.ConfigureAwait(false);
return fetchedPackages.ToList<INugetPackage>();
return fetchedPackages.Where(fetchedPackage => !(fetchedPackage is null)).ToList<INugetPackage>();
})
.GetAwaiter()
.GetResult();
Expand Down
Loading