From 75f271bf91eddf4b809640fd4697accf374d4c20 Mon Sep 17 00:00:00 2001
From: Luis Oliveira
Date: Mon, 8 Apr 2024 14:36:20 +0100
Subject: [PATCH] Remove the need of the '.' on the allowedExtensions
configuration.
---
.../camera-media-uploader/media-uploader.component.tsx | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/packages/esm-patient-attachments-app/src/camera-media-uploader/media-uploader.component.tsx b/packages/esm-patient-attachments-app/src/camera-media-uploader/media-uploader.component.tsx
index 9b5e77f929..7d85be7328 100644
--- a/packages/esm-patient-attachments-app/src/camera-media-uploader/media-uploader.component.tsx
+++ b/packages/esm-patient-attachments-app/src/camera-media-uploader/media-uploader.component.tsx
@@ -70,13 +70,7 @@ const MediaUploaderComponent = () => {
return true;
}
- const match = fileName.match(/\.[^.\s]+$/);
-
- if (!match) {
- return false;
- }
-
- const fileExtension = match[0].toLowerCase();
+ const fileExtension = fileName.split('.').pop();
return allowedExtensions?.includes(fileExtension.toLowerCase());
};
@@ -101,7 +95,7 @@ const MediaUploaderComponent = () => {
ext) || ['*']}
+ accept={allowedExtensions?.map((ext) => '.' + ext) || ['*']}
labelText={t('fileSizeInstructions', 'Drag and drop files here or click to upload')}
tabIndex={0}
multiple={multipleFiles}