Skip to content

Commit 17b3a38

Browse files
authored
[Fix] Account Linking UpdateMigrationsByType (#31428)
Fix #31427
1 parent 90a3c20 commit 17b3a38

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

services/externalaccount/user.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package externalaccount
55

66
import (
77
"context"
8+
"strconv"
89
"strings"
910

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

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

0 commit comments

Comments
 (0)