Source resource owner from prev path if needed (#1949)

## Description

Deleted collections have full path set to nil but have their previous path populated. When gathering information for statistics reporting, check that we have a non-nil value to get resource owner from.

## Does this PR need a docs update or release note?

- [ ]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x]  No 

## Type of change

- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

* closes #1948 

## Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
ashmrtn 2022-12-23 15:13:32 -08:00 committed by GitHub
parent 73c4937456
commit 76ebd7254d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,6 +98,18 @@ func ResourceOwnerSet(cs []Collection) []string {
for _, c := range cs { for _, c := range cs {
fp := c.FullPath() fp := c.FullPath()
if fp == nil {
// Deleted collections have their full path set to nil but the previous
// path will be populated.
fp = c.PreviousPath()
}
if fp == nil {
// This should not happen, but keep us from hitting a nil pointer
// exception if it does somehow occur. Statistics will be off though.
continue
}
rs[fp.ResourceOwner()] = struct{}{} rs[fp.ResourceOwner()] = struct{}{}
} }