From 9d43ab99035683b3d8af5e7504eb44a880aaffb3 Mon Sep 17 00:00:00 2001 From: b1ek Date: Sat, 4 Mar 2023 17:08:54 +1000 Subject: [PATCH] add minimum length for content --- routes/upload.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/routes/upload.js b/routes/upload.js index da86057..b920e84 100644 --- a/routes/upload.js +++ b/routes/upload.js @@ -13,6 +13,12 @@ async function upload(req, res) { } const data = req.body.text; + + if (data.length < 8) { + res.send('Too short'); + return; + } + const id = await content.create(data); res.redirect( '/view?id=' + encodeURIComponent(id)