From 6c59ef313fdaac7fa8e9089be758c4651f8b9412 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 27 Jul 2026 02:11:10 -0400 Subject: [PATCH] refac --- backend/open_webui/models/notes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/models/notes.py b/backend/open_webui/models/notes.py index 55e19e7aaf..01986d9cfe 100644 --- a/backend/open_webui/models/notes.py +++ b/backend/open_webui/models/notes.py @@ -107,6 +107,7 @@ class NoteTable: ) -> NoteModel: # We exclude access_grants to inject them note_data = NoteModel.model_validate(note).model_dump(exclude={'access_grants'}) + note_data['data'] = note_data.get('data') or {} note_data['access_grants'] = ( access_grants if access_grants is not None else await self._get_access_grants(note_data['id'], db=db) ) @@ -308,9 +309,9 @@ class NoteTable: if 'title' in form_data: note.title = form_data['title'] if 'data' in form_data: - note.data = {**note.data, **form_data['data']} + note.data = {**(note.data or {}), **(form_data['data'] or {})} if 'meta' in form_data: - note.meta = {**note.meta, **form_data['meta']} + note.meta = {**(note.meta or {}), **(form_data['meta'] or {})} if not db.is_modified(note) and 'access_grants' not in form_data: return await self._to_note_model(note, db=db)