Skip to content

Commit

Permalink
add null or empty check for package version contents (#10561)
Browse files Browse the repository at this point in the history
  • Loading branch information
aparajit-pratap authored Apr 13, 2020
1 parent 85c4120 commit 41b8610
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,15 @@ internal void ExecutePackageDownload(string name, PackageVersion version, string

// determine if any of the packages contain binaries or python scripts.
var containsBinariesOrPythonScripts = dependencyVersionHeaders.Any(x =>
x.contains_binaries ||
x.contents.Contains(PackageManagerClient.PackageContainsBinariesConstant) ||
x.contents.Contains(PackageManagerClient.PackageContainsPythonScriptsConstant));
{
var are_contents_empty = string.IsNullOrEmpty(x.contents);
var contains_binaries = x.contains_binaries ||
!are_contents_empty && x.contents.Contains(PackageManagerClient.PackageContainsBinariesConstant);
var contains_python =
!are_contents_empty && x.contents.Contains(PackageManagerClient.PackageContainsPythonScriptsConstant);
return contains_binaries || contains_python;

});

// if any do, notify user and allow cancellation
if (containsBinariesOrPythonScripts)
Expand Down

0 comments on commit 41b8610

Please sign in to comment.