Users: Fix potential panics on UID translation (#95794)

fix potential panics on UID translation
This commit is contained in:
Jo
2024-11-04 18:50:26 +01:00
committed by GitHub
parent 305123df91
commit 4452d0932a
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -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
}
}
+4
View File
@@ -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
}
}