diff --git a/apps/mobile/app/services/exporter.ts b/apps/mobile/app/services/exporter.ts index a2aec62b7..96a51c0d8 100644 --- a/apps/mobile/app/services/exporter.ts +++ b/apps/mobile/app/services/exporter.ts @@ -256,6 +256,7 @@ async function exportNote( } if (!hasAttachments) { + console.log("creating file..."); return createFile(noteItem as ExportableNote, type, path, cacheFolder); } else { return createZip(1, cacheFolder, type, path, callback); @@ -314,15 +315,23 @@ async function createFile( path: string, cacheFolder: string ) { - const file = await ScopedStorage.createFile( - path, - basename(noteItem?.path as string), - FileMime[type] - ); const exportedFile = join(cacheFolder, noteItem?.path as string); - await copyFileAsync("file://" + exportedFile, file.uri); + let filePath: string; + if (Platform.OS === "android") { + const file = await ScopedStorage.createFile( + path, + basename(noteItem?.path as string), + FileMime[type] + ); + await copyFileAsync("file://" + exportedFile, file.uri); + filePath = file.uri; + } else { + filePath = join(path, basename(noteItem.path)); + await RNFetchBlob.fs.mv(exportedFile, filePath); + } + return { - filePath: file.uri, + filePath: filePath, fileDir: path, type: FileMime[type], name: type,