Users: Fix potential panics on UID translation (#95794)
fix potential panics on UID translation
This commit is contained in:
@@ -32,6 +32,10 @@ func UIDToIDHandler(teamService Service) func(ctx context.Context, orgID int64,
|
||||
return resourceID, nil
|
||||
}
|
||||
team, err := teamService.GetTeamByID(ctx, &GetTeamByIDQuery{UID: resourceID, OrgID: orgID})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return strconv.FormatInt(team.ID, 10), err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,10 @@ func UIDToIDHandler(userService Service) func(ctx context.Context, userID string
|
||||
user, err := userService.GetByUID(ctx, &GetUserByUIDQuery{
|
||||
UID: userID,
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return strconv.FormatInt(user.ID, 10), err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user