diff --git a/src/components/ImportSpreadsheet.tsx b/src/components/ImportSpreadsheet.tsx index 76918982652d..2ce31be701db 100644 --- a/src/components/ImportSpreadsheet.tsx +++ b/src/components/ImportSpreadsheet.tsx @@ -75,15 +75,15 @@ function ImportSpreedsheet({backTo, goTo}: ImportSpreedsheetProps) { if (!validateFile(file)) { return; } - if (!file.uri) { + let fileURI = file.uri ?? URL.createObjectURL(file); + if (!fileURI) { return; } - let filePath = file.uri; if (Platform.OS === 'ios') { - filePath = filePath.replace(/^.*\/Documents\//, `${RNFetchBlob.fs.dirs.DocumentDir}/`); + fileURI = fileURI.replace(/^.*\/Documents\//, `${RNFetchBlob.fs.dirs.DocumentDir}/`); } - fetch(filePath) + fetch(fileURI) .then((data) => { setIsReadingFIle(true); return data.arrayBuffer(); @@ -98,6 +98,9 @@ function ImportSpreedsheet({backTo, goTo}: ImportSpreedsheetProps) { }) .finally(() => { setIsReadingFIle(false); + if (fileURI && !file.uri) { + URL.revokeObjectURL(fileURI); + } }); }; @@ -185,7 +188,7 @@ function ImportSpreedsheet({backTo, goTo}: ImportSpreedsheetProps) { height={CONST.IMPORT_SPREADSHEET.ICON_HEIGHT} /> {translate('common.dropTitle')} - {translate('common.dropMessage')} + {translate('common.dropMessage')}