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/lib/utils/getFileExtension.ts

13 lines
275 B

export const getFileExtension = (fileName?: string): string => {
if (!fileName) {
return 'file';
}
const arr = fileName.split('.');
if (arr.length < 2 || (arr[0] === '' && arr.length === 2)) {
return 'file';
}
return arr.pop()?.toLocaleUpperCase() || 'file';
};