Node.js based forum software built for the modern web
fix: #14269, don't treat test.test.test as url in input-text
Barış Soner Uşaklıea92fb9759c3
diff --git a/src/user/profile.js b/src/user/profile.jsindex c45ff04d97..b4915d65c1 100644--- a/src/user/profile.js+++ b/src/user/profile.js@@ -109,11 +109,17 @@ module.exports = function (User) {));}+ const isUrl = value && validator.isURL(String(value).trim(), {+ require_protocol: true,+ require_valid_protocol: true,+ require_tld: true,+ });+if (type === 'input-number' && !utils.isNumber(value)) {throw new Error(tx.compile('error:custom-user-field-invalid-number', field.name));- } else if (value && type === 'input-text' && validator.isURL(value)) {+ } else if (value && type === 'input-text' && isUrl) {throw new Error(tx.compile('error:custom-user-field-invalid-text', field.name));@@ -121,7 +127,7 @@ module.exports = function (User) {throw new Error(tx.compile('error:custom-user-field-invalid-date', field.name));- } else if (value && field.type === 'input-link' && !validator.isURL(String(value))) {+ } else if (value && field.type === 'input-link' && !isUrl) {throw new Error(tx.compile('error:custom-user-field-invalid-link', field.name));