Skip to content

Commit

Permalink
share: fixed another possible panic in GetShare
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed Nov 4, 2024
1 parent 165a578 commit 9969421
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions share/sql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ func (m *mgr) GetShare(ctx context.Context, ref *collaboration.ShareReference) (
err = errtypes.NotFound(ref.String())
}

// resolve grantee's user type
s.Grantee.GetUserId().Type, _ = m.getUserType(ctx, s.Grantee.GetUserId().OpaqueId)
// resolve grantee's user type if applicable
if s.Grantee.Type == provider.GranteeType_GRANTEE_TYPE_USER {
s.Grantee.GetUserId().Type, _ = m.getUserType(ctx, s.Grantee.GetUserId().OpaqueId)
}

path, err := m.getPath(ctx, s.ResourceId)
if err != nil {
Expand Down Expand Up @@ -602,8 +604,10 @@ func (m *mgr) GetReceivedShare(ctx context.Context, ref *collaboration.ShareRefe
return nil, err
}

// resolve grantee's user type
s.Share.Grantee.GetUserId().Type, _ = m.getUserType(ctx, s.Share.Grantee.GetUserId().OpaqueId)
// resolve grantee's user type if applicable
if s.Share.Grantee.Type == provider.GranteeType_GRANTEE_TYPE_USER {
s.Share.Grantee.GetUserId().Type, _ = m.getUserType(ctx, s.Share.Grantee.GetUserId().OpaqueId)
}

return s, nil
}
Expand Down

0 comments on commit 9969421

Please sign in to comment.