Some code patterns throw 400 error on code block macro while saving in 8.1.1

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Low
    • None
    • Affects Version/s: 8.1.1
    • None
    • 1
    • Severity 3 - Minor

      Problem

      While saving page with Code block macro,  some specific set of code are throwing 400 error in Confluence 8.1.1. This error is not noted in lower versions such as 7.19.6

      Environment

      .Confluence 8.1.1 DC

       PostgreSQL 14.6

      Steps to Reproduce

      1. Create a page
      2. Insert "Code Block" macro into the page
      3. Add the following code block into the macro:

      <isNotEmpty property="fechaInicio" prepend="AND">
      <![CDATA[
      trunc(fechaCreacion) >= trunc(#fechaInicio#)
      ]]>
      </isNotEmpty>
      <isNotEmpty property="fechaFin" prepend="AND">
      <![CDATA[
      trunc(fechaCreacion) <= trunc(#fechaFin#)
      ]]>
      </isNotEmpty>
      the "<![CDATA["
      

      4. Press update.

      Expected Results

      The page should be saved without issues.

       h3. Actual Results

      We notice 400 error while saving the page:

      Request:

      Request URL: http://localhost:8090/rest/api/content/2621441?status=draft
      Request Method: PUT
      Status Code: 400 
      Remote Address: [::1]:8090
      Referrer Policy: strict-origin-when-cross-origin
      Cache-Control: no-store
      Connection: close
      Content-Encoding: gzip
      Content-Type: application/json
      Date: Thu, 06 Apr 2023 11:37:52 GMT
      Expires: Thu, 01 Jan 1970 00:00:00 GMT
      Transfer-Encoding: chunked
      Vary: User-Agent
      X-AUSERNAME: sathya
      X-Content-Type-Options: nosniff
      X-Seraph-LoginReason: OK
      Accept: application/json, text/javascript, */*; q=0.01
      Accept-Encoding: gzip, deflate, br
      Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
      Connection: keep-alive
      Content-Length: 1131
      Content-Type: application/json; charset=UTF-8
      Cookie: confluence.browse.space.cookie=space-templates; confluence.list.pages.cookie=list-content-tree; AJS.conglomerate.cookie="|source-editor.wrap-lines=true"; load-tutorial-flow=true; confluence.last-web-item-clicked=system.space.tools%2Fcontenttools%2Fexport; mywork.tab.tasks=false; JSESSIONID=936CA346EA194C5F0B4793669D116E3A
      Host: localhost:8090
      Origin: http://localhost:8090
      Referer: http://localhost:8090/pages/resumedraft.action?draftId=2621442&draftShareId=0867db17-2d43-42ed-849b-ff7e23b78deb&
      sec-ch-ua: "Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"
      sec-ch-ua-mobile: ?0
      sec-ch-ua-platform: "macOS"
      Sec-Fetch-Dest: empty
      Sec-Fetch-Mode: cors
      Sec-Fetch-Site: same-origin
      User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
      X-Requested-With: XMLHttpRequest
      

      Payload:

      {"status":"current","title":"Code Macro","space":{"key":"OC"},"body":{"editor":{"value":"<table class=\"wysiwyg-macro\" style=\"background-image: url('http://localhost:8090/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&amp;locale=en_GB&amp;version=2'); background-repeat: no-repeat;\" data-macro-name=\"code\" aria-label=\"code macro\" data-macro-schema-version=\"1\" data-macro-body-type=\"PLAIN_TEXT\" data-mce-resize=\"false\"><tbody><tr><td class=\"wysiwyg-macro-body\"><pre>&lt;isNotEmpty property=\"fechaInicio\" prepend=\"AND\"&gt;<br />&lt;![CDATA[<br />trunc(fechaCreacion) &gt;= trunc(#fechaInicio#)<br />]]&gt;<br />&lt;/isNotEmpty&gt;<br />&lt;isNotEmpty property=\"fechaFin\" prepend=\"AND\"&gt;<br />&lt;![CDATA[<br />trunc(fechaCreacion) &lt;= trunc(#fechaFin#)<br />]]&gt;<br />&lt;/isNotEmpty&gt;<br />the \"&lt;![CDATA[\"</pre></td></tr></tbody></table><p>Test</p>","representation":"editor","content":{"id":"2621441"}}},"id":"2621441","type":"page","version":{"number":2,"message":"","minorEdit":true,"syncRev":"0.S9PpYAmWraQJsUXAVlxhO14.2"},"ancestors":[{"id":"98361","type":"page"}]}
      

      Workaround

      N/A

      Notes

            Assignee:
            Unassigned
            Reporter:
            Sathya Ganeshan
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: