From 7d62bc9b2f9f0136b85c2f9187bb0c658ee1bddc Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Thu, 18 Apr 2024 21:08:13 +0530 Subject: [PATCH 1/2] fix: Submit Expense - Error message about corrupted file when dragging and dropping image receipt. Signed-off-by: Krishna Gupta --- src/pages/iou/request/step/IOURequestStepScan/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 654f9e9d9f91..b44aa633d27f 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -481,6 +481,7 @@ function IOURequestStepScan({ onDrop={(e) => { const file = e?.dataTransfer?.files[0]; if (file) { + file.uri = URL.createObjectURL(file); setReceiptAndNavigate(file); } }} From a3c3ec9f91425637e423331289880aae04d500c6 Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Fri, 19 Apr 2024 14:10:29 +0530 Subject: [PATCH 2/2] update validateImageForCorruption util function. Signed-off-by: Krishna Gupta --- src/libs/fileDownload/FileUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/fileDownload/FileUtils.ts b/src/libs/fileDownload/FileUtils.ts index d9893d93d2f6..6517a7a28642 100644 --- a/src/libs/fileDownload/FileUtils.ts +++ b/src/libs/fileDownload/FileUtils.ts @@ -242,7 +242,7 @@ function base64ToFile(base64: string, filename: string): File { } function validateImageForCorruption(file: FileObject): Promise { - if (!Str.isImage(file.name ?? '')) { + if (!Str.isImage(file.name ?? '') || !file.uri) { return Promise.resolve(); } return new Promise((resolve, reject) => {