Skip to content

Commit

Permalink
Merge pull request #21285 from Expensify/youssef_remove_filetype_rest…
Browse files Browse the repository at this point in the history
…riction

Remove filetype restriction for file uploads
  • Loading branch information
youssef-lr authored Aug 9, 2023
2 parents 9a6b4a8 + 4118f4b commit 5fd39b9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 68 deletions.
58 changes: 0 additions & 58 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,64 +35,6 @@ const CONST = {
ARROW_HIDE_DELAY: 3000,

API_ATTACHMENT_VALIDATIONS: {
// Same as the PHP layer allows
/* 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,

Expand Down
10 changes: 0 additions & 10 deletions src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,6 @@ function AttachmentModal(props) {
* @returns {Boolean}
*/
const isValidFile = useCallback((_file) => {
const {fileExtension} = FileUtils.splitExtensionFromFileName(lodashGet(_file, 'name', ''));
if (_.contains(CONST.API_ATTACHMENT_VALIDATIONS.UNALLOWED_EXTENSIONS, fileExtension.toLowerCase())) {
const invalidReason = 'attachmentPicker.notAllowedExtension';

setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle('attachmentPicker.wrongFileType');
setAttachmentInvalidReason(invalidReason);
return false;
}

if (lodashGet(_file, 'size', 0) > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) {
setIsAttachmentInvalid(true);
setAttachmentInvalidReasonTitle('attachmentPicker.attachmentTooLarge');
Expand Down

0 comments on commit 5fd39b9

Please sign in to comment.