Skip to content

Commit

Permalink
Fix calls to strings.HasSuffix and strings.HasPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
John Wregglesworth committed Jun 13, 2024
1 parent 20bb408 commit 348085b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ type AppConfiguration struct {
}

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

0 comments on commit 348085b

Please sign in to comment.