import (
"context"
+ "strconv"
"strings"
"code.gitea.io/gitea/models/auth"
// 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
}