Skip to content

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

core: do not allow empty titles

Abdullah Attac6ee1e6303e6
diff --git a/packages/core/src/collections/notes.ts b/packages/core/src/collections/notes.ts
index d8f1db0aa..be166b767 100644
--- a/packages/core/src/collections/notes.ts
+++ b/packages/core/src/collections/notes.ts
@@ -136,8 +136,7 @@ export class Notes implements ICollection {
const currentNoteTitleFields = await this.db
.sql()
.selectFrom("notes")
- .select("isGeneratedTitle")
- .select("title")
+ .select(["isGeneratedTitle", "title"])
.where("id", "=", id)
.executeTakeFirst();
if (isUpdating) {
@@ -153,7 +152,8 @@ export class Notes implements ICollection {
currentNoteTitleFields?.title !== headlineTitle
) {
item.title = titleFormat.replace(HEADLINE_REGEX, headlineTitle);
- }
+ } else if (item.title === "")
+ item.title = currentNoteTitleFields?.title || "Untitled";
}
if (isUpdating) {