Wiki transformer doesn't parse links with `|` in the text (regardless of escaping)

Issue #48 invalid
Craig Lawrence created an issue

From: https://jira.atlassian.com/browse/JRACLOUD-81908

[Testing | Google|https://wwww.google.com/]

[Testing \| Google|https://wwww.google.com/]

[Google|https://wwww.google.com/]

Converts to ADF:

{
  "type" : "doc",
  "version" : 1,
  "content" : [ {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : "[Testing | Google|https://wwww.google.com/]"
    } ]
  }, {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : "[Testing | Google|https://wwww.google.com/]"
    } ]
  }, {
    "type" : "paragraph",
    "content" : [ {
      "type" : "text",
      "text" : "Google",
      "marks" : [ {
        "type" : "link",
        "attrs" : {
          "href" : "https://wwww.google.com/"
        }
      } ]
    } ]
  } ]
}

We would like

"type" : "text",
      "text" : "Testing | Google",
      "marks" : [ {
        "type" : "link",
        "attrs" : {
          "href" : "https://wwww.google.com/"
        }

Comments (7)

  1. Chris Fuller

    This is true on Server/Data Center, so I’m not sure what we can do about it: https://bulldog.internal.atlassian.com/browse/CRF-4?focusedId=3580338&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-3580338

    As with the issue Jimmy mentioned yesterday about paragraph separations inside a table (JRACLOUD-81887) , the answer here does not involve the ADF library; the answer is to make Clone work on the ADF content directly instead of doing a round trip, because we know that there are things that necessarily do not and never will successfully round trip.

  2. Craig Lawrence reporter

    @Chris Fuller My thinking was that this isn’t a clone bug per se since standard API usage can also initiate round-tripping.

    It seemed like a reasonable expectation of customers for this to work, and was most likely not going to present a code challenge for us if we just take the last pipe as the URL delimiter.
    Although I realise on further thought there could also be weird cases if URLs themselves contain pipes.

  3. Chris Fuller

    No, taking the last | as the URL delimiter is definitely wrong, because there is also this syntax:

    [Google|https://www.google.com/|This is the title text]

    which does this (hover over the link when you get to the target comment): Comment on CRF-4

    We should not be trying to modify how the Wiki Renderer does its job because we can’t easily change the behaviour for Server/DC. ADF and the Wiki Renderer are not and never will be at 100% feature parity, so round tripping will always have limitations and should be avoided wherever we can. If a customer intermixes API versions and that triggers loss of fidelity, that’s one thing, but for our own Clone operation to lose fidelity is just not acceptable, and (as shown by JRACLOUD-81887) this is only one of several such problems that will occur. Clone needs to stop using Wiki as the source of truth.

  4. Craig Lawrence reporter

    Okay, I’ll amend the advice. I’m sure not if we have a ticket for tracking cloning with ADF.

  5. Log in to comment