Skip to content

Commit

Permalink
fix: Remove all control characters when reading console input
Browse files Browse the repository at this point in the history
  • Loading branch information
cetteup committed Apr 16, 2023
1 parent d775c46 commit eae0220
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/update-plex-ipv6-access-url/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"os"
"strings"
"unicode"

"github.com/cetteup/update-plex-ipv6-access-url/internal/plex"
)
Expand Down Expand Up @@ -80,5 +81,7 @@ func getInput(prompt string) (string, error) {
if err != nil {
return "", err
}
return strings.TrimSuffix(input, "\n"), nil
return strings.TrimRightFunc(input, func(r rune) bool {
return unicode.IsControl(r)
}), nil
}

0 comments on commit eae0220

Please sign in to comment.