20831: Don't panic on empty params
authorPeter Amstutz <peter.amstutz@curii.com>
Fri, 17 Nov 2023 20:37:23 +0000 (15:37 -0500)
committerPeter Amstutz <peter.amstutz@curii.com>
Fri, 17 Nov 2023 20:37:23 +0000 (15:37 -0500)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

lib/controller/rpc/conn.go

index 095ce225f66ce20e58515903a3904af5eb6a61c2..6195b79da13794cee9dcfd2143cf05e3321a4a5e 100644 (file)
@@ -147,10 +147,13 @@ func (conn *Conn) requestAndDecode(ctx context.Context, dst interface{}, ep arva
        }
 
        if len(tokens) > 1 {
+               if params == nil {
+                       params = make(map[string]interface{})
+               }
                params["reader_tokens"] = tokens[1:]
        }
        path := ep.Path
-       if strings.Contains(ep.Path, "/{uuid}") {
+       if strings.Contains(ep.Path, "/{uuid}") && params != nil {
                uuid, _ := params["uuid"].(string)
                path = strings.Replace(path, "/{uuid}", "/"+uuid, 1)
                delete(params, "uuid")