Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2046

Space Improperly Encoded in Content-Disposition Filename

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 3.6.2.Final, 4.0.0.Beta6
    • 3.6.0.Final, 4.0.0.Beta4
    • jaxrs
    • None
    • Hide

      Simply post a file with a space in the filename.

      Show
      Simply post a file with a space in the filename.

    Description

      A change was introduced for RESTEASY-1779 to encode non-US-ASCII filenames per RFC 5987, but the fix was incorrect/incomplete. The filename is encoded using URLEncoder, which specifically replaces a space character (" ") with a plus sign ("+"). However, RFC 5987 3.2.1 specifies that any character not included in their attr-char set (defined in the same section should have their byte representation percent encoded per RFC 3986 section 2.1.

      Spaces are not included in the attr-char set defined in RFC 5987 3.2.1, so spaces should be percent-encoded per RFC 3986 as "%20":

      https://tools.ietf.org/html/rfc3986#section-2.1

      This bug results in some clients being unable to read a filename. For example, prior to this change, "Test file.pdf" would be show in the content-disposition header as:

      filename="Test file.pdf".

      After the change, it shows incorrectly as:

      filename*=utf-8''Test+File.pdf

      The correct encoding should be:

      filename*=utf-8''Test%20file.pdf

      Attachments

        Issue Links

          Activity

            People

              pjurak Petr Jurak (Inactive)
              kkmix Ken Mix
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: