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 <ENTER> 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 <k@knt.li>
This commit is contained in:
Casper Børgesen
2026-03-05 15:19:08 +01:00
committed by GitHub
parent d36ac9ddda
commit b5afe82713

View File

@@ -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 <ENTER> 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")
}
}