The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/app/lib/server/functions/validateNameChars.ts

21 lines
373 B

export const validateNameChars = (name: string | undefined): boolean => {
if (typeof name !== 'string') {
return false;
}
const invalidChars = /[<>\\/]/;
if (invalidChars.test(name)) {
return false;
}
try {
const decodedName = decodeURI(name);
if (invalidChars.test(decodedName)) {
return false;
}
} catch (err) {
return false;
}
return true;
};