From 62b2d0341e47f7a8ac028793470a49ecedd62899 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Sun, 14 Nov 2021 13:41:27 -0500 Subject: [PATCH] fix #1831 RPL_ENDOFWHO should send the original, un-normalized mask --- irc/handlers.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/irc/handlers.go b/irc/handlers.go index 05cf3bda..ee8f6817 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -3328,12 +3328,15 @@ func (client *Client) rplWhoReply(channel *Channel, target *Client, rb *Response // WHO [%,] func whoHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) bool { - mask := msg.Params[0] - var err error - if mask == "" { - rb.Add(nil, server.name, ERR_UNKNOWNERROR, client.nick, "WHO", client.t("First param must be a mask or channel")) + origMask := utils.SafeErrorParam(msg.Params[0]) + if origMask != msg.Params[0] { + rb.Add(nil, server.name, ERR_UNKNOWNERROR, client.Nick(), "WHO", client.t("First param must be a mask or channel")) return false - } else if mask[0] == '#' { + } + + mask := origMask + var err error + if mask[0] == '#' { mask, err = CasefoldChannel(msg.Params[0]) } else { mask, err = CanonicalizeMaskWildcard(mask) @@ -3430,7 +3433,7 @@ func whoHandler(server *Server, client *Client, msg ircmsg.Message, rb *Response } } - rb.Add(nil, server.name, RPL_ENDOFWHO, client.nick, mask, client.t("End of WHO list")) + rb.Add(nil, server.name, RPL_ENDOFWHO, client.nick, origMask, client.t("End of WHO list")) return false }