Skip to content

Commit

Permalink
[F] UpsertUserAll Crash with usernames longer than 8 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Nov 14, 2024
1 parent 705b6cc commit 6c5791b
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,15 @@ class UpsertUserAllHandler(
if (!userName.isValidUsername())
{
// Maybe it's encoded
userName = String(userName.toByteArray(Charsets.ISO_8859_1), Charsets.UTF_8)
if (!userName.isValidUsername()) 400 - "Invalid username"
val decodeUserName = String(userName.toByteArray(Charsets.ISO_8859_1), Charsets.UTF_8)
if (userName.isValidUsername()) {
userName = decodeUserName
} else {
logger.warn("Invalid username: $userName")
// Maybe it's from some self-made import tools or modified game
// So apply it if user not in database
userName = userData?.userName ?: userName
}
}
})

Expand Down

0 comments on commit 6c5791b

Please sign in to comment.