fix(notion-writer): skip archived blocks when replacing page content
The --replace flag failed with "Can't edit block that is archived" when a page contained previously archived blocks. Now skips them during clear. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -349,8 +349,10 @@ def clear_page_content(notion: Client, page_id: str) -> bool:
|
|||||||
# Get all child blocks
|
# Get all child blocks
|
||||||
children = notion.blocks.children.list(block_id=formatted_id)
|
children = notion.blocks.children.list(block_id=formatted_id)
|
||||||
|
|
||||||
# Delete each block
|
# Delete each block (skip already archived blocks)
|
||||||
for block in children.get('results', []):
|
for block in children.get('results', []):
|
||||||
|
if block.get('archived'):
|
||||||
|
continue
|
||||||
notion.blocks.delete(block_id=block['id'])
|
notion.blocks.delete(block_id=block['id'])
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user