From 0873da811a03284a45ae8337790f80e1bb1d8e1b Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Sun, 13 Aug 2017 14:57:13 +0200 Subject: [PATCH] Fixed panic on Resource when posting to /name instead of /name/ --- resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resource.go b/resource.go index 0f76a94..257575d 100644 --- a/resource.go +++ b/resource.go @@ -30,7 +30,7 @@ func NewResource(list, create Func, get, update, delete IDFunc) *Resource { func (resource *Resource) Handle(path string, w http.ResponseWriter, req *http.Request, user *auth.User) bool { // Get the subpath out of the path subpath := req.URL.Path[len(path):] - if subpath[0] == '/' { + if len(subpath) > 0 && subpath[0] == '/' { subpath = subpath[1:] }