Handle the empty mount accessor case. (#14507)

This commit is contained in:
Nick Cabatoff 2022-03-16 09:28:05 -04:00 committed by GitHub
parent ada3d31dd1
commit 9e18350cf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -2099,11 +2099,15 @@ func (a *ActivityLog) precomputedQueryWorker(ctx context.Context) error {
mountRecord := make([]*activity.MountRecord, 0, len(nsMap[nsID].Mounts))
for mountAccessor, mountData := range nsMap[nsID].Mounts {
var displayPath string
valResp := a.core.router.ValidateMountByAccessor(mountAccessor)
if valResp == nil {
displayPath = fmt.Sprintf("deleted mount; accessor %q", mountAccessor)
if mountAccessor == "" {
displayPath = "no mount accessor (pre-1.10 upgrade?)"
} else {
displayPath = valResp.MountPath
valResp := a.core.router.ValidateMountByAccessor(mountAccessor)
if valResp == nil {
displayPath = fmt.Sprintf("deleted mount; accessor %q", mountAccessor)
} else {
displayPath = valResp.MountPath
}
}
mountRecord = append(mountRecord, &activity.MountRecord{