diff --git a/src/CONST.js b/src/CONST.js index 8b380ae2beef..369049a6e79d 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -35,7 +35,62 @@ const CONST = { API_ATTACHMENT_VALIDATIONS: { // Same as the PHP layer allows - ALLOWED_EXTENSIONS: ['webp', 'jpg', 'jpeg', 'png', 'gif', 'pdf', 'html', 'txt', 'rtf', 'doc', 'docx', 'htm', 'tiff', 'tif', 'xml', 'mp3', 'mp4', 'mov'], + /* eslint-disable-next-line max-len */ + UNALLOWED_EXTENSIONS: [ + 'ade', + 'adp', + 'apk', + 'appx', + 'appxbundle', + 'bat', + 'cab', + 'chm', + 'cmd', + 'com', + 'cpl', + 'diagcab', + 'diagcfg', + 'diagpack', + 'dll', + 'dmg', + 'ex', + 'ex_', + 'exe', + 'hta', + 'img', + 'ins', + 'iso', + 'isp', + 'jar', + 'jnlp', + 'js', + 'jse', + 'lib', + 'lnk', + 'mde', + 'msc', + 'msi', + 'msix', + 'msixbundle', + 'msp', + 'mst', + 'nsh', + 'pif', + 'ps1', + 'scr', + 'sct', + 'shb', + 'sys', + 'vb', + 'vbe', + 'vbs', + 'vhd', + 'vxd', + 'wsc', + 'wsf', + 'wsh', + 'xll', + ], // 24 megabytes in bytes, this is limit set on servers, do not update without wider internal discussion MAX_SIZE: 25165824, diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index ed40878285a3..ea5f5baa1558 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -167,8 +167,8 @@ class AttachmentModal extends PureComponent { */ isValidFile(file) { const {fileExtension} = FileUtils.splitExtensionFromFileName(lodashGet(file, 'name', '')); - if (!_.contains(CONST.API_ATTACHMENT_VALIDATIONS.ALLOWED_EXTENSIONS, fileExtension.toLowerCase())) { - const invalidReason = `${this.props.translate('attachmentPicker.notAllowedExtension')} ${CONST.API_ATTACHMENT_VALIDATIONS.ALLOWED_EXTENSIONS.join(', ')}`; + if (_.contains(CONST.API_ATTACHMENT_VALIDATIONS.UNALLOWED_EXTENSIONS, fileExtension.toLowerCase())) { + const invalidReason = this.props.translate('attachmentPicker.notAllowedExtension'); this.setState({ isAttachmentInvalid: true, attachmentInvalidReasonTitle: this.props.translate('attachmentPicker.wrongFileType'), diff --git a/src/languages/en.js b/src/languages/en.js index b7131985b4f5..ca2976391924 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -152,7 +152,7 @@ export default { attachmentTooSmall: 'Attachment too small', sizeNotMet: 'Attachment size must be greater than 240 bytes.', wrongFileType: 'Attachment is the wrong type', - notAllowedExtension: 'Attachments must be one of the following types:', + notAllowedExtension: 'This filetype is not allowed', }, avatarCropModal: { title: 'Edit photo', diff --git a/src/languages/es.js b/src/languages/es.js index 466392854f2a..537bfcb62189 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -151,7 +151,7 @@ export default { attachmentTooSmall: 'Archivo adjunto demasiado pequeño', sizeNotMet: 'El archivo adjunto debe ser mas grande que 240 bytes.', wrongFileType: 'El tipo del archivo adjunto es incorrecto', - notAllowedExtension: 'Los archivos adjuntos deben ser de uno de los siguientes tipos:', + notAllowedExtension: 'Este tipo de archivo no está permitido', }, avatarCropModal: { title: 'Editar foto',