diff --git a/src/Classes/ImportTab.lua b/src/Classes/ImportTab.lua index 4dbab4dbb3..45942e6ed2 100644 --- a/src/Classes/ImportTab.lua +++ b/src/Classes/ImportTab.lua @@ -411,7 +411,7 @@ function ImportTabClass:DownloadCharacterList() accountName = self.controls.accountName.buf:gsub("^[%s?]+", ""):gsub("[%s?]+$", ""):gsub("%s", "+") end local sessionID = #self.controls.sessionInput.buf == 32 and self.controls.sessionInput.buf or (main.gameAccounts[accountName] and main.gameAccounts[accountName].sessionID) - launch:DownloadPage(realm.hostName.."character-window/get-characters?accountName="..accountName.."&realm="..realm.realmCode, function(response, errMsg) + launch:DownloadPage(realm.hostName.."character-window/get-characters?accountName="..accountName:gsub("-", "%%23"):gsub("#", "%%23").."&realm="..realm.realmCode, function(response, errMsg) if errMsg == "Response code: 401" then self.charImportStatus = colorCodes.NEGATIVE.."Sign-in is required." self.charImportMode = "GETSESSIONID" @@ -443,7 +443,7 @@ function ImportTabClass:DownloadCharacterList() end -- GGG's character API has an issue where for /get-characters the account name is not case-sensitive, but for /get-passive-skills and /get-items it is. -- This workaround grabs the profile page and extracts the correct account name from one of the URLs. - launch:DownloadPage(realm.hostName..realm.profileURL..accountName, function(response, errMsg) + launch:DownloadPage(realm.hostName..realm.profileURL..accountName:gsub("#", "%%23"), function(response, errMsg) if errMsg then self.charImportStatus = colorCodes.NEGATIVE.."Error retrieving character list, try again ("..errMsg:gsub("\n"," ")..")" self.charImportMode = "GETACCOUNTNAME" @@ -455,6 +455,7 @@ function ImportTabClass:DownloadCharacterList() self.charImportMode = "GETSESSIONID" return end + realAccountName = realAccountName:gsub("-", "#") self.controls.accountName:SetText(realAccountName) accountName = realAccountName self.charImportStatus = "Character list successfully retrieved." @@ -558,11 +559,11 @@ function ImportTabClass:SaveAccountHistory() if not historyList[self.controls.accountName.buf] then t_insert(historyList, self.controls.accountName.buf) historyList[self.controls.accountName.buf] = true - self.controls.accountHistory:SelByValue(self.controls.accountName.buf) table.sort(historyList, function(a,b) return a:lower() < b:lower() end) self.controls.accountHistory:CheckDroppedWidth(true) + self.controls.accountHistory:SelByValue(self.controls.accountName.buf) end end @@ -574,7 +575,7 @@ function ImportTabClass:DownloadPassiveTree() local sessionID = #self.controls.sessionInput.buf == 32 and self.controls.sessionInput.buf or (main.gameAccounts[accountName] and main.gameAccounts[accountName].sessionID) local charSelect = self.controls.charSelect local charData = charSelect.list[charSelect.selIndex].char - launch:DownloadPage(realm.hostName.."character-window/get-passive-skills?accountName="..accountName.."&character="..charData.name.."&realm="..realm.realmCode, function(response, errMsg) + launch:DownloadPage(realm.hostName.."character-window/get-passive-skills?accountName="..accountName:gsub("#", "%%23").."&character="..charData.name.."&realm="..realm.realmCode, function(response, errMsg) self.charImportMode = "SELECTCHAR" if errMsg then self.charImportStatus = colorCodes.NEGATIVE.."Error importing character data, try again ("..errMsg:gsub("\n"," ")..")" @@ -596,7 +597,7 @@ function ImportTabClass:DownloadItems() local sessionID = #self.controls.sessionInput.buf == 32 and self.controls.sessionInput.buf or (main.gameAccounts[accountName] and main.gameAccounts[accountName].sessionID) local charSelect = self.controls.charSelect local charData = charSelect.list[charSelect.selIndex].char - launch:DownloadPage(realm.hostName.."character-window/get-items?accountName="..accountName.."&character="..charData.name.."&realm="..realm.realmCode, function(response, errMsg) + launch:DownloadPage(realm.hostName.."character-window/get-items?accountName="..accountName:gsub("#", "%%23").."&character="..charData.name.."&realm="..realm.realmCode, function(response, errMsg) self.charImportMode = "SELECTCHAR" if errMsg then self.charImportStatus = colorCodes.NEGATIVE.."Error importing character data, try again ("..errMsg:gsub("\n"," ")..")"