Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-13976

Allow backslash-escaped line terminators in content token string arguments

    XMLWordPrintable

Details

    Description

      The stringRegex field in ContentBuilder.Tokenizer disallows line terminators in content token arguments (see line #141 in ContentBuilder.java):

      // Sequence of (1) not \ " CR LF and (2) \ followed by non line terminator
      
      private static final String stringRegex = "\"([^\\\\\"\\r\\n]|(\\\\.))*\"";
      

      I propose allowing escaped line terminators, in the tradition of using backslashes as line continuation characters in various scripting languages, including Bash and Python:

      // Sequence of (1) not \ " CR LF and (2) \ followed by any non-CR/LF character or (CR)LF
      private static final String stringRegex = "\"([^\\\\\"\\r\\n]|(\\\\(?:.|\r?\n)))*\"";
      

      Attachments

        Activity

          slide_o_mix Alex Earl added a comment -

          Feel free to fork and submit a pull request. That would be the quickest way to get this in as I am working on some other features/debug right now.

          slide_o_mix Alex Earl added a comment - Feel free to fork and submit a pull request. That would be the quickest way to get this in as I am working on some other features/debug right now.
          sarowe Steve Rowe added a comment -

          Okay, will do.

          sarowe Steve Rowe added a comment - Okay, will do.
          sarowe Steve Rowe added a comment - Done: https://github.com/jenkinsci/email-ext-plugin/pull/39
          slide_o_mix Alex Earl added a comment -

          Fixed in 5fc0aab

          slide_o_mix Alex Earl added a comment - Fixed in 5fc0aab
          sarowe Steve Rowe added a comment -

          Thanks!

          sarowe Steve Rowe added a comment - Thanks!

          People

            slide_o_mix Alex Earl
            sarowe Steve Rowe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: