diff --git a/assets/get.go b/assets/get.go index 7f9af7d..f1b158d 100644 --- a/assets/get.go +++ b/assets/get.go @@ -211,6 +211,14 @@ func getRecursive(stub *sw.StubWrapper, pvtCollection, key string, keysChecked [ return nil, errors.WrapErrorWithStatus(err, "failed to resolve asset references", 500) } + keyIsFetchedInScope := false + for _, key := range keysCheckedInScope { + if key == elemKey.Key() { + keyIsFetchedInScope = true + break + } + } + keyIsFetched := false for _, key := range keysChecked { if key == elemKey.Key() { @@ -218,10 +226,11 @@ func getRecursive(stub *sw.StubWrapper, pvtCollection, key string, keysChecked [ break } } - if keyIsFetched { + if keyIsFetched && !keyIsFetchedInScope { continue } keysChecked = append(keysChecked, elemKey.Key()) + keysCheckedInScope = append(keysCheckedInScope, elemKey.Key()) var subAsset map[string]interface{} if elemKey.IsPrivate() {