Skip to content

Commit

Permalink
Fixes #1544 - server error in certain refresh scenarios on the edit p…
Browse files Browse the repository at this point in the history
…ackage page.
  • Loading branch information
Tim Lovell-Smith committed Sep 3, 2013
1 parent 1dfbebc commit 53003d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/NuGetGallery/Controllers/PackagesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,6 @@ public virtual ActionResult Edit(string id, string version)
};

var pendingMetadata = _editPackageService.GetPendingMetadata(package);
model.HasPendingMetadata = pendingMetadata != null;
model.Edit = new EditPackageVersionRequest(package, pendingMetadata);
return View(model);
}
Expand All @@ -607,7 +606,16 @@ public virtual ActionResult Edit(string id, string version, EditPackageRequest f

if (!ModelState.IsValid)
{
return View();
formData.PackageId = package.PackageRegistration.Id;
formData.PackageTitle = package.Title;
formData.Version = package.Version;

var packageRegistration = _packageService.FindPackageRegistrationById(id);
formData.PackageVersions = packageRegistration.Packages
.OrderByDescending(p => new SemanticVersion(p.Version), Comparer<SemanticVersion>.Create((a, b) => a.CompareTo(b)))
.ToList();

return View(formData);
}

// Add the edit request to a queue where it will be processed in the background.
Expand Down
2 changes: 0 additions & 2 deletions src/NuGetGallery/RequestModels/EditPackageRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ public class EditPackageRequest
public string Version { get; set; }

public IList<Package> PackageVersions { get; set; }

public bool HasPendingMetadata { get; set; }
}
}

0 comments on commit 53003d6

Please sign in to comment.