regex for avatars

This commit is contained in:
Akif9748 2022-08-27 14:20:14 +03:00
parent 39bb72d73b
commit 1f737277b2

View file

@ -23,7 +23,7 @@ app.post("/", rateLimit({
const user2 = new UserModel({ name: req.body.username })
if (avatar) user2.avatar = avatar;
if (avatar&&/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g.test(avatar)) user2.avatar = avatar;
await user2.takeId()
await user2.save();