From 42e4238aa1f45ee69e4719bdc77aee9235de0062 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Thu, 22 May 2025 11:20:44 +0500 Subject: [PATCH] core: do not allow empty titles --- packages/core/src/collections/notes.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/collections/notes.ts b/packages/core/src/collections/notes.ts index 97d8c76b3..f95be2dee 100644 --- a/packages/core/src/collections/notes.ts +++ b/packages/core/src/collections/notes.ts @@ -145,8 +145,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) { @@ -162,7 +161,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) {