A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: do not allow notebooks with empty title
thecodrr952aa5e58cb1
diff --git a/packages/core/__tests__/notebooks.test.js b/packages/core/__tests__/notebooks.test.jsindex d23511412..8ba717e94 100644--- a/packages/core/__tests__/notebooks.test.js+++ b/packages/core/__tests__/notebooks.test.js@@ -40,3 +40,9 @@ test("unpin a notebook", () =>notebook = db.notebooks.notebook(id);expect(notebook.data.pinned).toBe(false);}));++test("updating notebook with empty title should throw", () =>+ notebookTest().then(async ({ db, id }) => {+ expect(id).toBeDefined();+ await expect(db.notebooks.add({ id, title: "" })).rejects.toThrow();+ }));diff --git a/packages/core/collections/notebooks.js b/packages/core/collections/notebooks.jsindex 6d92b34de..4aaa5cbb0 100644--- a/packages/core/collections/notebooks.js+++ b/packages/core/collections/notebooks.js@@ -24,14 +24,13 @@ export default class Notebooks extends Collection {)return;- if (!oldNotebook && !notebookArg.title)- throw new Error("Notebook must contain at least a title.");-let notebook = {...oldNotebook,...notebookArg,};+ if (!notebook.title) throw new Error("Notebook must contain a title.");+notebook = {id,type: "notebook",