Skip to content

Commit

Permalink
Make sure the user suffix is appended correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
John Wregglesworth committed Jun 12, 2024
1 parent 9f25608 commit 20bb408
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ type AppConfiguration struct {

func (a *App) FixUsername(username string) string {
if !strings.HasSuffix(username, a.userSuffix) {
// Only add a @ if the configured user suffix doesn't already
// start with one.
if strings.HasPrefix("@", a.userSuffix) {
return fmt.Sprintf("%s%s", username, a.userSuffix)
}
return fmt.Sprintf("%s@%s", username, a.userSuffix)
}
return username
Expand Down

0 comments on commit 20bb408

Please sign in to comment.