Jira serializes "\r" return characters into multi-line text custom fields, inflating the character count

XMLWordPrintable

    • 7.13
    • 3
    • Severity 3 - Minor
    • 1

      Issue Summary

      When reading in multi-line text field data from the database to display when viewing an issue, Jira serializes "\r" carriage returns into each line, artificially inflating the character count. If the field content is close to or meets the character limit, you will be unable to make any edits to the issue in the UI; the validator will throw an error indicating that the text entered for that custom field is too long.

      Steps to Reproduce

      1. Create a new multi-line text custom field and add it field scheme of test project
      2. Create a new test issue
      3. Import the attached repro1.txt file via REST. You can copy and paste the Curl command from attached curl1.txt, substitute username, custom field ID, and issue key as needed.
      4. View the newly-created record in the customfieldvalue table and check the character count:
        select textvalue from customfieldvalue where id  = (select max(id) from customfieldvalue);
        
        select length(textvalue) from customfieldvalue where id  = (select max(id) from customfieldvalue);
        
      1. Attempt to edit the issue in the UI, note the validation error indicating the field data is too long.
      2. Create another test issue
      3. Import the attached repro2.txt file via REST. You can copy and paste the Curl command from attached curl2.txt, substitute username, custom field ID, and issue key as needed. This is a much smaller file to demonstrate the injection of the carriage returns to the data.
      4. Check the record and character count:
        select textvalue from customfieldvalue where id  = (select max(id) from customfieldvalue);
        
        select length(textvalue) from customfieldvalue where id  = (select max(id) from customfieldvalue);
        
      1. Navigate to the issue in the UI and edit the text in the the custom field to append a final "." character.
      2. Check the record and character count again

      Expected Results

      In the first test, Jira should allow you to save changes to the issue as the custom field data is at the limit.

      In the second test, the character count of the field should only increment by 1.

      Actual Results

      In the first test, Jira serializes the "\r" characters into the field data, causing it to exceed the character count.

      In the second test, you can see this character injection when reviewing the data in the customfield. The character count has grown more than the expected single character and you can now see the "\r" characters injected into the data.

      Workaround

      There has been no workaround identified at this time.

        1. repro2.txt
          3 kB
        2. repro1.txt
          32 kB
        3. curl2.txt
          3 kB
        4. curl1.txt
          32 kB

            Assignee:
            Unassigned
            Reporter:
            TJ Royall
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: