v0.15.1 Minor fix

This commit is contained in:
David Sainty 2024-06-26 15:49:43 +10:00
parent 3449f875e8
commit 1ce4a94a67

View File

@ -1,5 +1,5 @@
# gossamer threads migration-import code
# v0.15
# v0.15.1
require 'mysql2'
require 'open-uri'
@ -137,7 +137,7 @@ class GossamerForumsImporter < ImportScripts::Base
# Sanitize the username to meet Discourse's requirements
def sanitize_username(original_username, email, real_name)
# original_username = username
sanitized_username = username.gsub(/[^a-zA-Z0-9._-]/, '_')
sanitized_username = original_username.gsub(/[^a-zA-Z0-9._-]/, '_')
sanitized_username = "#{sanitized_username}." if sanitized_username.length < 2 # Allow two-character usernames
sanitized_username = sanitized_username[0, 20] if sanitized_username.length > 20
firststep_sanitized = sanitized_username