Skip to content

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

use db.tags.sanitize to clean a tag

ammarahm-edb0ada4aeb0ca
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index b4713abd2..6055056e0 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -495,7 +495,7 @@ export const ActionSheetComponent = ({
paragraph: 'Change the title of the tag ' + alias,
positivePress: async value => {
if (!value || value === '' || value.trimStart().length == 0) return;
- await db.tags.rename(note.id, value.replace(/[\s+#|&;$%@"'=<>()+,]/g, "").toLowerCase());
+ await db.tags.rename(note.id, db.tags.sanitize(value));
Navigation.setRoutesToUpdate([
Navigation.routeNames.Notes,
Navigation.routeNames.NotesPage,
diff --git a/apps/mobile/src/components/TagsDialog/index.js b/apps/mobile/src/components/TagsDialog/index.js
index 4dc992524..f2ebc15ad 100644
--- a/apps/mobile/src/components/TagsDialog/index.js
+++ b/apps/mobile/src/components/TagsDialog/index.js
@@ -95,6 +95,7 @@ const TagsDialog = () => {
text: '',
});
try {
+
await db.notes.note(note.id).tag(tag);
useTagStore.getState().setTags();
setNote(db.notes.note(note.id).data);
@@ -139,7 +140,7 @@ const TagsDialog = () => {
fwdRef={inputRef}
autoCapitalize="none"
onChangeText={v => {
- setQuery(v ? v.replace(/[\s+#|&;$%@"'=<>()+,]/g, "").toLowerCase() : v);
+ setQuery(db.tags.sanitize(v));
}}
onSubmit={onSubmit}
height={50}