14287: Ignore etag and unsigned_manifest_text in collection updates.
authorTom Clegg <tclegg@veritasgenetics.com>
Fri, 17 May 2019 19:31:28 +0000 (15:31 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Mon, 17 Jun 2019 13:54:39 +0000 (09:54 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

lib/controller/router/request.go

index de288a0a2f90dae43a45fda0c4e3dc277b15c083..47d8bb1109d645b0ca3f266fc29f1b6b5d84a62a 100644 (file)
@@ -97,6 +97,13 @@ func (rtr *router) loadRequestParams(req *http.Request, attrsKey string) (map[st
        }
 
        if v, ok := params[attrsKey]; ok && attrsKey != "" {
+               if v, ok := v.(map[string]interface{}); ok {
+                       // Delete field(s) that appear in responses
+                       // but not in update attrs, so clients can
+                       // fetch-modify-update.
+                       delete(v, "etag")
+                       delete(v, "unsigned_manifest_text")
+               }
                params["attrs"] = v
                delete(params, attrsKey)
        }