From 4d6bb5638e49bcdebdf17fe42f52d6f5d3a2f875 Mon Sep 17 00:00:00 2001 From: TheJetOU <31071116+TheJetOU@users.noreply.github.com> Date: Wed, 19 Jun 2019 00:32:36 +0300 Subject: [PATCH] Prevent duplicate options in polls (#5532) --- server/chat-plugins/poll.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/chat-plugins/poll.js b/server/chat-plugins/poll.js index d868109963..19112cfa1d 100644 --- a/server/chat-plugins/poll.js +++ b/server/chat-plugins/poll.js @@ -258,6 +258,10 @@ const commands = { return this.errorReply("Too many options for poll (maximum is 8)."); } + if (new Set(options).size !== options.length) { + return this.errorReply("There are duplicate options in the poll."); + } + room.poll = new Poll(room, {source: params[0], supportHTML: supportHTML}, options); room.poll.display();