Uploaded image for project: 'Xray for Jira Cloud'
  1. Xray for Jira Cloud
  2. XRAYCLOUD-10295

String Evaluation Fails for Multiline Comment Bodies When Using .contains() and .startsWith()

    XporterXMLWordPrintable

Details

    • Bug
    • Status: Waiting Approval
    • Medium
    • Resolution: Unresolved
    • Xray Cloud 7.4.0
    • None
    • Document Generator
    • None
    • Browser: Version 145.0.7632.76 (Official Build) (arm64)

    • UNCOVERED

    Description

      Description

      When evaluating conditions on Jira comment bodies inside a Document Generator Excel template, string operations such as .contains() or .startsWith() fail if the comment contains line breaks.

      The goal is to filter comments that contain QC5 and print them in a dedicated section.

      Observed behavior:

      • Works for comments like:
        • QC5 without a line break
        • QC5: Quality concern. No tests added so far
      • Fails (comment is skipped) when the comment contains a line break after QC5, for example for the following cases:
        • QC5 with a line\nbreak.
        • QC5:\nABC
        • QC5:\n1234

      If the condition is replaced with an always-true expression, for example:

      #{if (%{true})}

      then all comments are rendered correctly, including those with line breaks.

      This confirms:

      • Rendering ${Comments[j].Body} works correctly.
      • The issue only occurs when applying .contains() or .startsWith() on a multiline comment body.

      Pre-conditions

      • An issue with multiple comments.
      • At least one comment:
        • Contains QC5 on a single line.
        • Contains QC5 followed by a newline.

      Example failing template snippet:

      #{for j=CommentsCount}
      #{if (%{'${Comments[j].Body}'.contains('QC5')})}
      ${Comments[j].Body}
      #{end}
      #{end} 

      How to reproduce

      • Create or open an issue.
      • Add the following comments:
        • QC5 without a line break
        • QC5: Quality concern
        • QC5:\nABC
        • QC5:\n1234
      • Use the above Excel template snippet.
      • Generate the document.

      Actual result/Attachments

      • Comments containing QC5 with a line break are skipped.
      • Single-line QC5 comments are rendered correctly.
      • Replacing the condition with true renders all comments, including multiline ones.

      Attachments:

      • Excel template used for reproduction.[^QC5 Comments.xlsx]
      • Sample generated report: [^Issues - 2026-02-19T144518.038.xlsx]
        • One tab showing filtered behavior (multiline comments missing).
        • One tab showing all comments using an always-true condition.

      Expected result

      String checks such as:

      • .contains('QC5')
      • .startsWith('QC5')

      should behave consistently regardless of whether the comment body contains line breaks.

      Multiline comments containing or starting with QC5 should be included in the output.

      Version

      • N/A

      Workaround

      N/A

      Attachments

        Activity

          People

            bernardo.cottim Bernardo Cottim
            joshua.tesfaye Joshua Tesfaye
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: