diff options
author | Giteabot <teabot@gitea.io> | 2024-06-20 21:53:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 13:53:15 +0000 |
commit | 9ecaeda66e0869af0c4f68b5c257522c7d3c7d6b (patch) | |
tree | 7c30a5700a626f781c900db84191c6cd2d2f496b | |
parent | 7fbcc58062c5cad5c4c8674915ea0fffa659b51d (diff) | |
download | gitea-9ecaeda66e0869af0c4f68b5c257522c7d3c7d6b.tar.gz gitea-9ecaeda66e0869af0c4f68b5c257522c7d3c7d6b.zip |
[Fix] Account Linking UpdateMigrationsByType (#31428) (#31434)
Backport #31428 by Sumit189
Co-authored-by: Sumit <sumit.18.paul@gmail.com>
-rw-r--r-- | services/externalaccount/user.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/services/externalaccount/user.go b/services/externalaccount/user.go index e2de41da18..3cfd8c81f9 100644 --- a/services/externalaccount/user.go +++ b/services/externalaccount/user.go @@ -5,6 +5,7 @@ package externalaccount import ( "context" + "strconv" "strings" "code.gitea.io/gitea/models/auth" @@ -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 } |