From ebf38065f8a0c0c3d1a3a7ce2a4caaaad712432c Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Mon, 6 Nov 2017 14:50:03 +0100 Subject: Added short project ID name support if not ambiguous. --- lib/apiv1/exec.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'lib/apiv1/exec.go') diff --git a/lib/apiv1/exec.go b/lib/apiv1/exec.go index 0167196..8ffad07 100644 --- a/lib/apiv1/exec.go +++ b/lib/apiv1/exec.go @@ -105,15 +105,19 @@ func (s *APIService) execCmd(c *gin.Context) { } // Allow to pass id in url (/exec/:id) or as JSON argument - id := c.Param("id") - if id == "" { - id = args.ID + idArg := c.Param("id") + if idArg == "" { + idArg = args.ID } - if id == "" { + if idArg == "" { common.APIError(c, "Invalid id") return } - + id, err := s.mfolders.ResolveID(idArg) + if err != nil { + common.APIError(c, err.Error()) + return + } f := s.mfolders.Get(id) if f == nil { common.APIError(c, "Unknown id") -- cgit 1.2.3-korg