fix mung of usernames on collision in shared channels; tilde is not a valid character (#25575)

Этот коммит содержится в:
Doug Lauder
2023-12-01 11:33:13 -05:00
коммит произвёл GitHub
родитель 57a87d8ca5
Коммит ce7259ddc5
2 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@@ -47,12 +47,14 @@ func sanitizeUserForSync(user *model.User) *model.User {
return user
}
const MungUsernameSeparator = "-"
// mungUsername creates a new username by combining username and remote cluster name, plus
// a suffix to create uniqueness. If the resulting username exceeds the max length then
// it is truncated and ellipses added.
func mungUsername(username string, remotename string, suffix string, maxLen int) string {
if suffix != "" {
suffix = "~" + suffix
suffix = MungUsernameSeparator + suffix
}
// If the username already contains a colon then another server already munged it.