diff --git a/app/api/memos.py b/app/api/memos.py index 9c94b47..0fd4cf5 100644 --- a/app/api/memos.py +++ b/app/api/memos.py @@ -243,7 +243,14 @@ async def update_memo( doc.extracted_text = content doc.file_hash = _content_hash(content) doc.file_size = len(content.encode("utf-8")) - doc.title = body.title.strip() if body.title and body.title.strip() else _auto_title(content) + # PATCH semantics: title 필드를 명시적으로 보낸 경우만 덮어쓴다. + # 체크박스 토글 경로처럼 {content}만 PATCH 하면 기존 title을 보존해야 함 + # (이전엔 None→_auto_title(content)로 제목이 체크박스 라인으로 덮어씌워지는 버그). + if "title" in body.model_fields_set: + doc.title = body.title.strip() if body.title and body.title.strip() else _auto_title(content) + elif not (doc.title or "").strip(): + # 기존 title이 비어 있던 경우만 보강 + doc.title = _auto_title(content) doc.user_tags = _parse_hashtags(content) # stale AI 데이터 즉시 초기화