Skip to content

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

fix: add checks before saving content

ammarahm-ed17ce14071510
diff --git a/apps/mobile/share/index.js b/apps/mobile/share/index.js
index 78e61b1f4..5826465d8 100644
--- a/apps/mobile/share/index.js
+++ b/apps/mobile/share/index.js
@@ -362,7 +362,7 @@ const NotesnookShare = ({ quicknote = false }) => {
const onPress = async () => {
let content = await getContent();
- if (!content || content === '') {
+ if (!content || content === '' || typeof content !== 'string') {
return;
}
setLoading(true);
diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js
index 921b1b066..4b7ee8c9d 100644
--- a/apps/mobile/src/views/Editor/Functions.js
+++ b/apps/mobile/src/views/Editor/Functions.js
@@ -773,6 +773,7 @@ async function addToCollection(id) {
export async function saveNote(title, _id, data, type, sessionId, preventUpdate) {
console.log('saving note:', disableSaving, isSaving, _id, id);
+ if (typeof data !== 'string') return;
if (disableSaving || (isSaving && !id)) return;
if (preventUpdate) {
noteEdited = false;