Skip to content

Commit

Permalink
[Fix] Account Linking UpdateMigrationsByType (#31428)
Browse files Browse the repository at this point in the history
Fix #31427
  • Loading branch information
Sumit189 authored Jun 20, 2024
1 parent 90a3c20 commit 17b3a38
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions services/externalaccount/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package externalaccount

import (
"context"
"strconv"
"strings"

"code.gitea.io/gitea/models/auth"
Expand Down Expand Up @@ -82,6 +83,11 @@ func UpdateExternalUser(ctx context.Context, user *user_model.User, gothUser got

// UpdateMigrationsByType updates all migrated repositories' posterid from gitServiceType to replace originalAuthorID to posterID
func UpdateMigrationsByType(ctx context.Context, tp structs.GitServiceType, externalUserID string, userID int64) error {
// Skip update if externalUserID is not a valid numeric ID or exceeds int64
if _, err := strconv.ParseInt(externalUserID, 10, 64); err != nil {
return nil
}

if err := issues_model.UpdateIssuesMigrationsByType(ctx, tp, externalUserID, userID); err != nil {
return err
}
Expand Down

0 comments on commit 17b3a38

Please sign in to comment.