publish handler: errors out if rootPermanode is not a valid blobRef

http://camlistore.org/issue/164

Change-Id: If7c305f4c7a89eb67aabaf844b9e4aa111985b24
This commit is contained in:
mpl 2013-06-27 01:02:40 +02:00
parent ffad34ef94
commit bb60c7c887
1 changed files with 3 additions and 0 deletions

View File

@ -114,6 +114,9 @@ func newPublishFromConfig(ld blobserver.Loader, conf jsonconfig.Obj) (h http.Han
h, _ := ld.GetHandler(rootNode[0])
jsonSign := h.(*signhandler.Handler)
pn := blobref.Parse(rootNode[1])
if pn == nil {
return nil, fmt.Errorf("Invalid \"rootPermanode\" value; was expecting a blobRef, got %q.", rootNode[1])
}
if err := ph.setRootNode(jsonSign, pn); err != nil {
return nil, fmt.Errorf("error setting publish root permanode: %v", err)
}