Using convert storage to view API and understanding when it fails to convert

Hi folks,

Stumbled on this issue recently…

Using this API to convert the storage to view
https://developer.atlassian.com/cloud/confluence/rest/api-group-content-body/#api-api-contentbody-convert-to-post

And recently we have got a feedback from a client, who has reported that they started to get something like

 {
  "value": "<div class=\"error fatal-render-error\">Error: [com.ctc.wstx.exc.WstxLazyException] Unexpected character '=' (code 61); expected a semi-colon after the reference for entity 'avatarId'\n at [row,col {unknown-source}]: [135,190]</div>",
  "representation": "view",
  "_expandable": {
    "webresource": "",
    "embeddedContent": "",
    "mediaToken": "",
    "content": "/rest/api/content/245104781"
  },
  "_links": {
    "base": "https://XXXXX.atlassian.net/wiki",
    "context": "/wiki"
  }
}

The cause of the issue was easy to fix, but the question is - how we can reliably understand the conversion has failed?

Checking for “fatal-render-error” in a response!? :roll_eyes:

Alex

3 Likes

Hi @sash011,

Do you have a test case to reproduce this? It seems like a bug, and instead a proper error response should be returned.

Regards,
Dugald

1 Like

Oh, that is very simple actually.
Any non valid XHTML will do I think… (I understand that it is our problem to verify it’s valid, but sometimes… well, we might fail to recognise that in advance)

See a missing opening < before the "a" tag

& instead of &amp; in the link parameters

Would be good not to return 200 in this case… Or give some additional information about the error in the separate attribute (not in “value”)

Thanks @sash011,

The API is documented as always returning 200 responses so I created an issue to request a field be added in the response to indicate whether the content conversion was successful or not. See CONFCLOUD-71608.

Regards,
Dugald

1 Like

Thanks, hopefully it gets some attention sooner than later

1 Like