aboutsummaryrefslogtreecommitdiffstats
path: root/lib/apiv1/make.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-06 14:50:03 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-06 16:00:04 +0100
commitebf38065f8a0c0c3d1a3a7ce2a4caaaad712432c (patch)
tree00ca89c63f4ce48566202c6c32f76fe1ad3de4d3 /lib/apiv1/make.go
parent8d3f51e52894d46a4a92a944bc09f4ceaa1abf51 (diff)
Added short project ID name support if not ambiguous.
Diffstat (limited to 'lib/apiv1/make.go')
-rw-r--r--lib/apiv1/make.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/apiv1/make.go b/lib/apiv1/make.go
index 223d4bf..6e0c7d6 100644
--- a/lib/apiv1/make.go
+++ b/lib/apiv1/make.go
@@ -68,15 +68,19 @@ func (s *APIService) buildMake(c *gin.Context) {
}
// Allow to pass id in url (/make/: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
+ }
pf := s.mfolders.Get(id)
if pf == nil {
common.APIError(c, "Unknown id")
@@ -197,7 +201,7 @@ func (s *APIService) buildMake(c *gin.Context) {
data["RootPath"] = prj.RootPath
data["ExitImmediate"] = args.ExitImmediate
- err := common.ExecPipeWs(cmd, args.Env, sop, sess.ID, args.CmdID, execTmo, s.log, oCB, eCB, &data)
+ err = common.ExecPipeWs(cmd, args.Env, sop, sess.ID, args.CmdID, execTmo, s.log, oCB, eCB, &data)
if err != nil {
common.APIError(c, err.Error())
return