Skip to content

Commit 819c620

Browse files
authored
Handle account name spaces in import (#8100)
* fix import trim spaces Old code was removing all spaces, regardless of position. * Handle account name spaces by realm type PC: Remove all spaces from account name Console: Trim any leading/trailing space, encode any that remain for URL ("+").
1 parent 61e76bd commit 819c620

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/Classes/ImportTab.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,14 @@ end
402402
function ImportTabClass:DownloadCharacterList()
403403
self.charImportMode = "DOWNLOADCHARLIST"
404404
self.charImportStatus = "Retrieving character list..."
405-
-- Trim Trailing/Leading spaces
406-
local accountName = self.controls.accountName.buf:gsub('%s+', '')
407405
local realm = realmList[self.controls.accountRealm.selIndex]
406+
local accountName
407+
-- Handle spaces in the account name
408+
if realm.realmCode == "pc" then
409+
accountName = self.controls.accountName.buf:gsub("%s+", "")
410+
else
411+
accountName = self.controls.accountName.buf:gsub("^[%s?]+", ""):gsub("[%s?]+$", ""):gsub("%s", "+")
412+
end
408413
local sessionID = #self.controls.sessionInput.buf == 32 and self.controls.sessionInput.buf or (main.gameAccounts[accountName] and main.gameAccounts[accountName].sessionID)
409414
launch:DownloadPage(realm.hostName.."character-window/get-characters?accountName="..accountName.."&realm="..realm.realmCode, function(response, errMsg)
410415
if errMsg == "Response code: 401" then

0 commit comments

Comments
 (0)