mirror of
https://github.com/Wolvan/poll.horse.git
synced 2024-11-21 20:47:59 +01:00
Allow only 300 characters max
This prevents people from going crazy with gigabytes of data.
This commit is contained in:
parent
2db013c204
commit
2f41df7264
1 changed files with 2 additions and 2 deletions
|
@ -75,10 +75,10 @@ export default async function init(router: Router): Promise<void> {
|
|||
dupeCheckMode === "cookie" ? randomString(16) : null;
|
||||
const poll: Poll = {
|
||||
id,
|
||||
title: req.body.title || "",
|
||||
title: (req.body.title || "").trim().slice(0, 300),
|
||||
options: (() => {
|
||||
const result: { [option: string]: number } = {};
|
||||
for (const option of options) {
|
||||
for (const option of options.map(i => i.trim().slice(0, 300))) {
|
||||
if (option) result[option] = 0;
|
||||
}
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue