Skip to content

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

fix: sanitize color before assigning it to a note

thecodrr3f6f5e6f9c6c
diff --git a/packages/core/api/sync/__tests__/collector.test.js b/packages/core/api/sync/__tests__/collector.test.js
index 9804f2742..78e634b65 100644
--- a/packages/core/api/sync/__tests__/collector.test.js
+++ b/packages/core/api/sync/__tests__/collector.test.js
@@ -1,6 +1,15 @@
-import { databaseTest, TEST_NOTE, delay } from "../../../__tests__/utils";
+import {
+ databaseTest,
+ TEST_NOTE,
+ delay,
+ StorageInterface,
+} from "../../../__tests__/utils";
import Collector from "../collector";
+beforeEach(async () => {
+ StorageInterface.clear();
+});
+
test("newly created note should get included in collector", () =>
databaseTest().then(async (db) => {
const collector = new Collector(db);
diff --git a/packages/core/models/note.js b/packages/core/models/note.js
index f147bde50..9fbd5de6c 100644
--- a/packages/core/models/note.js
+++ b/packages/core/models/note.js
@@ -127,7 +127,7 @@ export default class Note {
await this._db.colors.untag(this._note.color, this._note.id);
await this._db.notes.add({
id: this.id,
- color,
+ color: this._db.colors.sanitize(color),
});
}