Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

check if attachment was found

ammarahm-ed62f1d6cd8f19
diff --git a/apps/mobile/src/utils/filesystem.js b/apps/mobile/src/utils/filesystem.js
index d3197af7c..4f24f5dad 100644
--- a/apps/mobile/src/utils/filesystem.js
+++ b/apps/mobile/src/utils/filesystem.js
@@ -96,6 +96,7 @@ async function uploadFile(filename, {url, headers}, cancelToken) {
useAttachmentStore.getState().remove(filename);
if (result) {
let attachment = db.attachments.attachment(filename);
+ if (!attachment) return result;
if (!attachment.metadata.type.startsWith('image/')) {
RNFetchBlob.fs.unlink(`${cacheDir}/${filename}`).catch(console.log);
}