Trim custom url before saving to DB

Was causing 404 errors when users accidentally included
white space after the custom url
This commit is contained in:
Kalle (Sendou)
2021-05-08 17:59:01 +03:00
parent 70b8183d2c
commit ff248d6270

View File

@@ -40,9 +40,11 @@ const profileHandler = async (req: NextApiRequest, res: NextApiResponse) => {
create: {
user: { connect: { id: user.id } },
...parsed.data,
customUrlPath: parsed.data.customUrlPath?.trim(),
},
update: {
...parsed.data,
customUrlPath: parsed.data.customUrlPath?.trim(),
},
where: { userId: user.id },
});