Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-23494

Issues can have a newline in the summary, which results in malformed email notifications

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      Using something like GreenHopper or the SOAP API, an issue can be created or edited to have a newline (i.e. "\n") character in the issue summary.

      This causes problems with plain text and HTML email notifications because the newline is not stripped out. Therefore the "Subject:" email header line will be split in such a way that the data section will start prematurely.

      Here is a script to create a sample issue:

      #!/usr/bin/env ruby
      require 'rubygems'
      gem 'soap4r'
      require 'soap/wsdlDriver'
      
      soap = SOAP::WSDLDriverFactory.new('http://localhost:8080/rpc/soap/jirasoapservice-v2?wsdl').create_rpc_driver
      token = soap.login('admin', 'password')
      issue_map = {
        :type => "1",
        :project => "TST",
        :summary => "This test issue has a newline\nafter the first occurrence of the word 'newline'",
        :description => "This is the description.",
        :assignee => "admin"
        };
      issue = soap.createIssue(token, issue_map);
      

      The resulting email has the subject "[JIRA] Created: (TST-4) This test issue has a newline" and the body looks like:

      after the
      first occurrence of the word 'newline'
      MIME-Version: 1.0
      Content-Type: text/html; charset=UTF-8
      Content-Transfer-Encoding: 7bit
      Precedence: bulk
      Auto-Submitted: auto-generated
      X-JIRA-FingerPrint: dee9d5d26e4e05c908d4fd9475e805a2
      
      <html>
      <head>
         <!--
         You are receiving this email because you have chosen HTML as your email preference.
         ...
      

      This is because the headers contain the following:

      From: "Admin (JIRA)" <mknight@atlassian.com>
      To: mknight@atlassian.com
      Message-ID: <2135917781.11.1295508323968.JavaMail.mknight@kitt.sydney.atlassian.com>
      Subject: [JIRA] Created: (TST-4) This test issue has a newline
      
      after the
       first occurrence of the word 'newline'
      MIME-Version: 1.0
      Content-Type: text/html; charset=UTF-8
      Content-Transfer-Encoding: 7bit
      Precedence: bulk
      Auto-Submitted: auto-generated
      X-JIRA-FingerPrint: dee9d5d26e4e05c908d4fd9475e805a2
      
      <html>
      <head>
          <!--
          You are receiving this email because you have chosen HTML as your email preference.
          ...
      

      The example here shows HTML emails, which are significantly affected because the HTML will not be rendered. It will just look like a plain text email full of mark-up.

      Attachments

        Issue Links

          Activity

            People

              edalgliesh Eric Dalgliesh
              mknight@atlassian.com Michael Knight
              Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: