From 10033905cf29b9d6680f8e0f877e38e3407c754d Mon Sep 17 00:00:00 2001 From: Avris Date: Tue, 7 Dec 2021 12:28:36 +0100 Subject: [PATCH] [user] disallow ending profile name with a dot --- server/routes/user.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/routes/user.js b/server/routes/user.js index f9317522..861e987d 100644 --- a/server/routes/user.js +++ b/server/routes/user.js @@ -26,7 +26,10 @@ const isSpam = (email) => { || email.length > 128; } -const replaceExtension = username => username.replace(/\.(txt|jpg|jpeg|png|pdf|gif|doc|docx|csv|js|css)$/i, '_$1'); +const replaceExtension = username => username + .replace(/\.(txt|jpg|jpeg|png|pdf|gif|doc|docx|csv|js|css|html)$/i, '_$1') + .replace(/\.$/, '') +; const saveAuthenticator = async (db, type, user, payload, validForMinutes = null) => { const id = ulid();