From ba51e110ada98640ca89e956917b5caa218a2863 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Mon, 29 Jan 2024 11:01:30 +0500 Subject: [PATCH] mobile: fix opening webclips --- .../app/common/filesystem/download-attachment.js | 10 +++++++--- .../app/screens/editor/tiptap/use-editor-events.ts | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/mobile/app/common/filesystem/download-attachment.js b/apps/mobile/app/common/filesystem/download-attachment.js index b97e0468c..575c9c1a6 100644 --- a/apps/mobile/app/common/filesystem/download-attachment.js +++ b/apps/mobile/app/common/filesystem/download-attachment.js @@ -183,7 +183,8 @@ export default async function downloadAttachment( cache: false, throwError: false, groupId: undefined, - base64: false + base64: false, + text: false } ) { await createCacheDir(); @@ -219,8 +220,11 @@ export default async function downloadAttachment( return; } - if (options.base64) { - return await db.attachments.read(attachment.metadata.hash, "base64"); + if (options.base64 || options.text) { + return await db.attachments.read( + attachment.metadata.hash, + options.base64 ? "base64" : "text" + ); } let filename = getFileNameWithExtension( diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts b/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts index fb4fe28fe..230beb7c6 100644 --- a/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts +++ b/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts @@ -427,7 +427,8 @@ export const useEditorEvents = ( attachment.type ); downloadAttachment(attachment.hash, true, { - base64: true, + base64: attachment.type === "image", + text: attachment.type === "web-clip", silent: true, groupId: editor.note.current?.id, cache: true