diff --git a/src/backend.ts b/src/backend.ts index d131f83..182774e 100644 --- a/src/backend.ts +++ b/src/backend.ts @@ -75,10 +75,10 @@ export default async function init(router: Router): Promise { 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;