Browse Source

Fixed panic on Resource when posting to /name instead of /name/

master
Gisle Aune 7 years ago
parent
commit
0873da811a
  1. 2
      resource.go

2
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 { func (resource *Resource) Handle(path string, w http.ResponseWriter, req *http.Request, user *auth.User) bool {
// Get the subpath out of the path // Get the subpath out of the path
subpath := req.URL.Path[len(path):] subpath := req.URL.Path[len(path):]
if subpath[0] == '/' {
if len(subpath) > 0 && subpath[0] == '/' {
subpath = subpath[1:] subpath = subpath[1:]
} }

Loading…
Cancel
Save