From 80cfbc1202419a88c30c6cc83f32c5ffac738a58 Mon Sep 17 00:00:00 2001 From: machadoum Date: Tue, 12 Nov 2024 14:24:08 +0100 Subject: [PATCH] Update file validation because the file type is empty on windows --- .../components/asset_criticality_file_uploader/constants.ts | 2 +- .../components/asset_criticality_file_uploader/validations.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality_file_uploader/constants.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality_file_uploader/constants.ts index c64128274aa3d..9db2cf4f7c8d6 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality_file_uploader/constants.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality_file_uploader/constants.ts @@ -5,5 +5,5 @@ * 2.0. */ -export const SUPPORTED_FILE_TYPES = ['text/csv', 'text/plain', 'text/tab-separated-values']; +export const SUPPORTED_FILE_TYPES = ['text/csv', 'text/plain', 'text/tab-separated-values', '.tsv']; export const SUPPORTED_FILE_EXTENSIONS = ['CSV', 'TXT', 'TSV']; diff --git a/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality_file_uploader/validations.ts b/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality_file_uploader/validations.ts index 06018a2496768..453b4b53f8df7 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality_file_uploader/validations.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality_file_uploader/validations.ts @@ -53,7 +53,7 @@ export const validateFile = ( file: File, formatBytes: (bytes: number) => string ): { valid: false; errorMessage: string; code: string } | { valid: true } => { - if (!SUPPORTED_FILE_TYPES.includes(file.type)) { + if (file.type !== '' && !SUPPORTED_FILE_TYPES.includes(file.type)) { return { valid: false, code: 'unsupported_file_type',