From f1f4358deecf7768de0650c8b0ad3b93ea8f3dbd Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 3 Dec 2025 14:27:09 +0100 Subject: [PATCH] app/core/note_payload.py aktualisiert --- app/core/note_payload.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/core/note_payload.py b/app/core/note_payload.py index 054262c..3d9064f 100644 --- a/app/core/note_payload.py +++ b/app/core/note_payload.py @@ -26,10 +26,18 @@ except Exception: def _as_dict(x) -> Dict[str, Any]: if isinstance(x, dict): return dict(x) - try: - return dict(x or {}) - except Exception: - return {"raw": str(x)} + # Versuche, ein ParsedMarkdown-ähnliches Objekt in ein Dict zu überführen + out: Dict[str, Any] = {} + # bekannte Attribute übernehmen + for attr in ("frontmatter", "body", "id", "note_id", "title", "path", "tags", "type", "created", "modified", "date"): + if hasattr(x, attr): + val = getattr(x, attr) + if val is not None: + out[attr] = val + # Fallback: wenn immer noch leer, raw speichern + if not out: + out["raw"] = str(x) + return out def _pick_args(*args, **kwargs) -> Tuple[Optional[str], Optional[dict]]: path = kwargs.get("path") or (args[0] if args else None)