Skip to content

publish_article reverts title changes saved via note_update_article #261

Description

@katanumahotori

Summary

When a published article has pending draft edits saved via note_update_article (which uses draft_save?is_temp_saved=true), calling note_publish_article publishes the new body but the old title. The title change is silently lost.

Reproduction

  1. Take a published article (e.g. key nXXXX) with title Old Title.
  2. note_update_article(article_id, title="New Title", body="new body") → returns success (saved as draft).
  3. note_publish_article(article_id=...) → article is published with the new body, but the live page still shows Old Title.

Confirmed on a real note.com article (2026-06-10).

Root cause

In publish_article() (src/note_mcp/api/articles.py), the title is read from data.name first, falling back to note_draft.name only when data.name is empty:

article_title = article_data.get("name", "")
if not article_title:
    note_draft = article_data.get("note_draft")
    ...

For a published article with pending edits, data.name holds the stale published title (truthy), so note_draft.name (the new title) is never used. Note the body logic right below already prefers note_draft.body — the title logic is asymmetric.

Fix

Prefer note_draft.name over data.name, mirroring the body logic. PR with a regression test incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions