Skip to content

Commit

Permalink
VerifyPackage on ApiController should treat version as optional param…
Browse files Browse the repository at this point in the history
…eter (#3903)
  • Loading branch information
xavierdecoster committed May 31, 2017
1 parent 980958b commit 0c290a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/NuGetGallery/Controllers/ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public async virtual Task<ActionResult> VerifyPackageKeyAsync(string id, string
private async Task<HttpStatusCodeWithBodyResult> VerifyPackageKeyInternalAsync(User user, Credential credential, string id, string version)
{
// Verify that the user has permission to push for the specific Id \ version combination.
var package = PackageService.FindPackageByIdAndVersionStrict(id, version);
var package = PackageService.FindPackageByIdAndVersion(id, version, semVerLevelKey: SemVerLevelKey.SemVer2);
if (package == null)
{
return new HttpStatusCodeWithBodyResult(
Expand Down
4 changes: 3 additions & 1 deletion tests/NuGetGallery.Facts/Controllers/ApiControllerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,9 @@ internal TestableApiController SetupController(string keyType, string scopes, Pa

var id = package?.PackageRegistration?.Id ?? "foo";
var version = package?.Version ?? "1.0.0";
controller.MockPackageService.Setup(s => s.FindPackageByIdAndVersionStrict(id, version)).Returns(package);
controller.MockPackageService
.Setup(s => s.FindPackageByIdAndVersion(id, version, SemVerLevelKey.SemVer2, true))
.Returns(package);

controller.SetCurrentUser(user, scopes);

Expand Down

0 comments on commit 0c290a8

Please sign in to comment.