From b5afe82713cf755d7d8bf624b5799aa3e0677676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Casper=20B=C3=B8rgesen?= Date: Thu, 5 Mar 2026 15:19:08 +0100 Subject: [PATCH] fix(cli): make user deletion confirmation check Windows compatible (#2339) The current implementation of the user confirmation when deleting a user using the CLI seems to favour Linux. On Windows the command adds "\r\n" to the user input while Linux only adds "\n". I have added an extra check to the confirmation, but GO is a new language for me, so there is probably a much better way to do this. --------- Co-authored-by: kolaente --- pkg/cmd/user.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/user.go b/pkg/cmd/user.go index 7a89466ca..902ac6317 100644 --- a/pkg/cmd/user.go +++ b/pkg/cmd/user.go @@ -361,7 +361,11 @@ var userDeleteCmd = &cobra.Command{ if err != nil { log.Fatalf("could not read confirmation message: %s", err) } - if text != "YES, I CONFIRM\n" { + + // On Windows a newline is \r\n, while on Linux it is only \n. + text = strings.TrimRight(text, "\r\n") + + if text != "YES, I CONFIRM" { log.Fatalf("invalid confirmation message") } }