Skip to content

Updating the title of an existing page does not work #133

@askalski85

Description

@askalski85

Why

In readme it is described that https://github.com/iamjackg/md2cf/blob/master/README.md#updating-an-existing-page

To update a page using its ID, use the --page-id option. This allows you to modify the page's title 

Small investigation

According to the code got the update call:
https://github.com/iamjackg/md2cf/blob/master/md2cf/api.py#L195

        update_structure = {
            "version": {
                "number": page.version.number + 1,
                "minorEdit": minor_edit,
            },
            "title": page.title,  # <-- using the passed existing_title is hardcoded
            "type": content_type,
            "body": {"storage": {"value": body, "representation": "storage"}},
        }

And the upsert operation when the page exists:
https://github.com/iamjackg/md2cf/blob/master/md2cf/upsert.py#L100

            existing_page = confluence.update_page(
                page=existing_page, # <-- We are passing existing_page with old title 
                body=page.body,
                parent_id=page.parent_id,
                update_message=page_message,
                labels=page.labels if replace_all_labels else None,
                minor_edit=minor_edit,
            )

Outcome

Page title is never updated. This was my first observation and apparently if I am not wrong this is the implemented behaviour. We should either fix the readme or the code.

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