From a404176c35658129bf8e9ac72ce53e81ac12b5aa Mon Sep 17 00:00:00 2001 From: Samuel Date: Fri, 6 May 2022 17:19:34 -0300 Subject: [PATCH] Fix recursive update with correct object assembly --- assets/put.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/assets/put.go b/assets/put.go index 2f7a83a..15bf91b 100644 --- a/assets/put.go +++ b/assets/put.go @@ -111,6 +111,13 @@ func putRecursive(stub *sw.StubWrapper, object map[string]interface{}, root bool return nil, errors.NewCCError("existing sub-asset could not be fetched", 404) } + // If asset key is not in object, add asset value to object (so that properties are not erased) + for k := range asset { + if _, ok := object[k]; !ok { + object[k] = asset[k] + } + } + // TODO: check property by property if asset must be updated } }