Duplicate keys in content property

Hi,
We’ve encountered a strange thing/bug with a customer of us: They have a content property with duplicate keys like this:

{
    {
      "id": "XXXXXXXXX",
      "key": "key-example",
      "value": [ ... 
      ],
      "version": {
        "when": "2021-01-23T12:58:55.368Z",
        "message": "",
        "number": 8,
        "minorEdit": false
      },
      "_expandable": {
        "content": "/rest/api/content/XXXXXXXX"
      },
      "_links": {
        "self": "https://xxxxxxxxx.atlassian.net/wiki/rest/api/content/XXXXXXXXX/property/key-example"
      }
    },
    {
      "id": "XXXXXXXXXXXX-different",
      "key": "key-example",
      "value": [],
      "version": {
        "when": "2019-10-20T11:33:43.948Z",
        "message": "",
        "number": 1,
        "minorEdit": false
      },
      "_expandable": {
        "content": "/rest/api/content/XXXXXXXXX"
      },
      "_links": {
        "self": "https://xxxxxxx.atlassian.net/wiki/rest/api/content/XXXXXXXXXX/property/key-example"
      }
    }
}

The property id’s are different, but the keys are the same. One key contains data, and the other is empty.
Is there a way to “deduplicate” the keys? And to select to keep the key with the data?

Hi @marc,

This seems like a bug so I’ve created CONFCLOUD-71704.

To fix this, the customer could try the following (noting some risk is involved):

  1. Install Property Inspector for Confluence.
  2. Visit the affected page/blog.
  3. Open the Property Inspector dialog (available from the … menu at the right).
  4. Note the properties and their values.
  5. Delete the affected properties.
  6. Create the desired property.

Regards,
Dugald

5 Likes

@dmorrow Thanks for the bug report and the advice regarding Property Inspector.

2 Likes

Follow up with some more information for reference if others have the same problem with duplicate content properties:

Our biggest problem is related to inconsistent reads:

  • if you read with GET /wiki/rest/api/content/{id}/property, you must iterate through all properties (and use _next calls to get the paginated properties). This allows you to read the duplicate content properties.
  • if you read with GET /wiki/rest/api/content/{id}/property/{key} you seem to get the most recent updated duplicate content property, but we don’t know if that is always the case.
  • if you read content properties with an expand call like GET /wiki/rest/api/content/{id}?expand=version,metadata.properties.myproperty you seem to get the least recent updated content property.