checking if tag name is valid when editing name. closes #2058

This commit is contained in:
Jack 2021-11-05 16:15:04 +00:00
parent 47654d6a9e
commit 6f77cb1b6d

View file

@ -244,6 +244,11 @@ class UserController {
try {
const { uid } = req.decodedToken;
const { tagid, newname } = req.body;
if (!isTagPresetNameValid(newname))
return res.status(400).json({
message:
"Tag name invalid. Name cannot contain special characters or more than 16 characters. Can include _ . and -",
});
await UsersDAO.editTag(uid, tagid, newname);
return res.sendStatus(200);
} catch (e) {