Skip to content

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

fix: allow use of unicode characters in tags

thecodrr09d375503c12
diff --git a/packages/core/__tests__/tags.test.js b/packages/core/__tests__/tags.test.js
index 060200ee7..c0247d2a4 100644
--- a/packages/core/__tests__/tags.test.js
+++ b/packages/core/__tests__/tags.test.js
@@ -104,4 +104,13 @@ describe.each([
note = db.notes.note(id);
check(note, value);
}));
+
+ test(`accented characters from ${action} title are not removed`, () =>
+ noteTest().then(async ({ db, id }) => {
+ let note = db.notes.note(id);
+ const _value = `échantillo`;
+ await note[action](_value);
+ note = db.notes.note(id);
+ check(note, _value);
+ }));
});
diff --git a/packages/core/collections/tags.js b/packages/core/collections/tags.js
index 7e96f9570..ef208afdc 100644
--- a/packages/core/collections/tags.js
+++ b/packages/core/collections/tags.js
@@ -112,7 +112,10 @@ export default class Tags extends Collection {
sanitize(tag) {
if (!tag) return;
let sanitized = tag.toLocaleLowerCase();
- sanitized = sanitized.replace(/[^a-z0-9_\-]+/g, "");
+ sanitized = sanitized.replace(
+ /[-+!@#$%^&*()+\{\}\]\[:;'"<>?/\.\s=,]+/g,
+ ""
+ );
return sanitized.trim();
}
}