Skip to content

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

mobile: fix image preview not loading image

Ammar Ahmedf10146be03e3
diff --git a/apps/mobile/app/common/filesystem/download-attachment.js b/apps/mobile/app/common/filesystem/download-attachment.js
index aa0d9959a..41486b6b5 100644
--- a/apps/mobile/app/common/filesystem/download-attachment.js
+++ b/apps/mobile/app/common/filesystem/download-attachment.js
@@ -34,6 +34,7 @@ import { useAttachmentStore } from "../../stores/use-attachment-store";
import { db } from "../database";
import Storage from "../database/storage";
import { cacheDir, copyFileAsync, releasePermissions } from "./utils";
+import { createCacheDir } from "./io";
export const FileDownloadStatus = {
Success: 1,
@@ -184,6 +185,7 @@ export default async function downloadAttachment(
}
) {
await createCacheDir();
+
let attachment = db.attachments.attachment(hash);
if (!attachment) {
console.log("attachment not found");
diff --git a/apps/mobile/app/common/filesystem/io.js b/apps/mobile/app/common/filesystem/io.js
index de2086a2c..c48e8b231 100644
--- a/apps/mobile/app/common/filesystem/io.js
+++ b/apps/mobile/app/common/filesystem/io.js
@@ -27,16 +27,12 @@ import { IOS_APPGROUPID } from "../../utils/constants";
export async function readEncrypted(filename, key, cipherData) {
await migrateFilesFromCache();
- console.log("read encrypted file...");
+ console.log("Read encrypted file...");
let path = `${cacheDir}/${filename}`;
try {
if (!(await exists(filename))) {
return false;
- } else {
- RNFetchBlob.fs.stat(path).then((r) => {
- console.log(r);
- });
}
const attachment = db.attachments.attachment(filename);