Skip to content

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

fix tag with same value but diff capitalization cause issue

ammarahm-ed05f83390c206
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index 525872e2d..b4713abd2 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -494,7 +494,8 @@ export const ActionSheetComponent = ({
title: 'Rename tag',
paragraph: 'Change the title of the tag ' + alias,
positivePress: async value => {
- await db.tags.rename(note.id, value);
+ if (!value || value === '' || value.trimStart().length == 0) return;
+ await db.tags.rename(note.id, value.replace(/[\s+#|&;$%@"'=<>()+,]/g, "").toLowerCase());
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 f04ec2e43..4dc992524 100644
--- a/apps/mobile/src/components/TagsDialog/index.js
+++ b/apps/mobile/src/components/TagsDialog/index.js
@@ -89,18 +89,7 @@ const TagsDialog = () => {
return;
}
- if (_query.startsWith('#')) {
- _query = _query.slice(1);
- }
-
let tag = _query;
- tag = tag.trim();
- if (tag.includes(' ')) {
- tag = tag.replace(' ', '_');
- }
- if (tag.includes(',')) {
- tag = tag.replace(',', '');
- }
setNote({...note, tags: note.tags ? [...note.tags, tag] : [tag]});
inputRef.current?.setNativeProps({
text: '',
@@ -150,7 +139,7 @@ const TagsDialog = () => {
fwdRef={inputRef}
autoCapitalize="none"
onChangeText={v => {
- setQuery(v);
+ setQuery(v ? v.replace(/[\s+#|&;$%@"'=<>()+,]/g, "").toLowerCase() : v);
}}
onSubmit={onSubmit}
height={50}