When saving markup to Jira issues/work items via API - suddenly logic changed on Jira side

Using rest/api/2/issue/{{issueKey}/comment

example POST body:

{
    "body": "_Added [Link|https://google.com] by plugin_"
}

now on retrieving I get this:

"body": "_Added_ [_Link_|https://google.com] _by plugin_",

Extra underscores added before and after ‘[’, ‘]’.

Which was not the case yet on Sunday cause our daily tests were working perfectly. Just yesterday afternoon it stopped working and it stayed this way.

Can someone confirm this is expected change and it will stay this way or maybe pushed by mistake?

Update 1:
just noticed that if we add embedded attachment: ‘!image-20241203-095939.png!’
Jira also adds now sizes to markup: “!image-20241203-095939.png|width=200,height=183!”

1 Like

Hello @SzymonWalkowski

I can confirm what you have described is happening.

However, as far as I can see, the markdown is still being applied correctly, as the underscore (italic) is being applied to the correct part of the string (the text only) and the result is being correct rendered on the screen

If you think about it, the URL part of the link and the square brackets themselves aren’t rendered on the screen, so it’s sort of poor syntax to wrap them inside underscores at the start and end of the text.

In reality, _Added_ [_Link_|https://google.com] _by plugin_ is the more correct syntax compared to _Added [Link|https://google.com] by plugin_

Maybe someone just improved the wiki markdown parser and now it correctly only applies underscores to the specific parts of the text that are actually able to be rendered as italic?

Maybe the change was done to make the wiki markdown match the syntax of ADF, which is to apply the mark of the type em to each segment of the text separately, not the whole lot collectively.

Anyhow, I don’t have any logs of old issues that I could use to confirm whether or not this changed recently.

That is true, all is still displayed correctly. Forgot to mention that.
It is just different output on API side when comparing to what is saved.

If this fits ADF syntax, that makes sense.

The only thing I wonder if this will remain as such.

1 Like

Uh, and whole thing was rollbacked by Atlassian :smiley: We did the fix and we revert it.

Wow! What’s even stranger is that the comments are now being created and stored in a different syntax depending on whether they are created by an API call versus using the GUI.

If I use the API to create a new comment with the underscores at both ends of the text string:
_Added a link to [Apple|https://apple.com] via the REST API_
then GET that issue and look at the comments, the body object syntax is the same:
"body": "_Added a link to [Apple|https://apple.com] via the REST API_"
so, the change that was recently in effect has been reverted Atlassian.

However, if I create that same italicised comment text with a link via the GUI:
Untitled
then GET the issue and look at the comments, the body object is the ‘new’ syntax
"body": "_Added a link to_ [_Apple_|https://apple.com] _via the GUI_"

Now, if I use the GUI to slightly alter the comment text I created via the REST API, it is saved using the ‘new’ syntax:
"body": "_Created a link to_ [_Apple_|https://apple.com] _via the REST API, then edited in the GUI_"

So, it seems the wiki markdown parsing rules are different for the GUI versus the API, and Atlassian were playing around with ‘closing the gap’ and has now undone that change.

Although this has no effect on any of my apps, it could be problematic for others.

1 Like