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

WildFly breaks utf-8 encoded strings in Content-Disposition header

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 3.0.10.Final, 3.6.2.Final
    • None
    • None
    • Hide

      1. create a jaxrs service

          @POST
          @Path ("/upload")
          public Response eatFile(MultipartFormDataInput input) {
      	Map<String, List<InputPart>> formDataMap = input.getFormDataMap();
      	List<InputPart> parts = formDataMap.get(Constants.P_FILE);
              InputPart registryFilePart = parts.get(0);
      	MultivaluedMap<String, String> headers = registryFilePart.getHeaders();
              String cd = headers.getFirst("Content-Disposition");
              System.out.println(cd);
          }
      

      2. create a page.html with form for file uploading

      3. upload a file with unicode characters in name via the rest-service

      4. compare name of the file and value of the Content-Disposition header.

      Show
      1. create a jaxrs service @POST @Path ( "/upload" ) public Response eatFile(MultipartFormDataInput input) { Map< String , List<InputPart>> formDataMap = input.getFormDataMap(); List<InputPart> parts = formDataMap.get(Constants.P_FILE); InputPart registryFilePart = parts.get(0); MultivaluedMap< String , String > headers = registryFilePart.getHeaders(); String cd = headers.getFirst( "Content-Disposition" ); System .out.println(cd); } 2. create a page.html with form for file uploading 3. upload a file with unicode characters in name via the rest-service 4. compare name of the file and value of the Content-Disposition header.

      a browsers don't send a charset information in multipart/form-data http-post. The apache mime4j library assume us-ascii charset for decoding parts headers. Therefore a javaee application can't receive correct non-english characters in Content-Disposition header and application can't correct determinate uploaded filename.

            rsigal@redhat.com Ronald Sigal
            sandello Denis Kostousov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: