-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #1260 by updating the Id casing on each upload. #1373
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -622,6 +622,12 @@ public virtual async Task<ActionResult> VerifyPackage(bool? listed) | |
package = _packageService.CreatePackage(nugetPackage, currentUser, commitChanges: false); | ||
Debug.Assert(package.PackageRegistration != null); | ||
|
||
// Update the package registration's ID if it doesn't already match. | ||
if (nugetPackage.Metadata != null) // A little extra defensiveness makes the tests simpler :) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why isn't there a throwing else block, would that also make the tests more complicated? It seems wrong to me to accept package uploads without a package ID in the package (although it's likely we would fail before we got to this point, if that is the case maybe we don't need an if statement?). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. github makes this code look like it's in GetPackageOwnerActionFormResult which doesn't make sense to me as an abstraction. Is this a github bug, or a real oddity in the code? |
||
{ | ||
package.PackageRegistration.Id = nugetPackage.Metadata.Id; | ||
} | ||
|
||
_packageService.PublishPackage(package, commitChanges: false); | ||
|
||
if (listed == false) | ||
|
@@ -642,7 +648,8 @@ public virtual async Task<ActionResult> VerifyPackage(bool? listed) | |
_indexingService.UpdateIndex(); | ||
|
||
// If we're pushing a new stable version of NuGet.CommandLine, update the extracted executable. | ||
if (package.PackageRegistration.Id.Equals(Constants.NuGetCommandLinePackageId, StringComparison.OrdinalIgnoreCase) && | ||
if (!String.IsNullOrEmpty(package.PackageRegistration.Id) && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again accepting null or empty package ids feels kinda wrong. |
||
package.PackageRegistration.Id.Equals(Constants.NuGetCommandLinePackageId, StringComparison.OrdinalIgnoreCase) && | ||
package.IsLatestStable) | ||
{ | ||
await _nugetExeDownloaderService.UpdateExecutableAsync(nugetPackage); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: "But Andrew, what if we need the history of the Id for previous packages?" A: "It's in the Nupkgs :)"