MultipartFormDataInput upload with non ASCII file name. Quarkus

I faced some difficulties to upload file with non ASCII file name.

Part of the code is:

package org.example;

import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
import org.jboss.resteasy.annotations.providers.multipart.MultipartForm;
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;

@Path("/hello")
public class ExampleResource {

    @POST
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public void hello(@MultipartForm MultipartFormDataInput formDataInput) {
        Map<String, List<InputPart>> dataMap = formDataInput.getFormDataMap();
        List<InputPart> inputs = dataMap.get("attachment");
        System.out.println("Data map: " + dataMap);
        System.out.println("Data inputs: " + inputs);
    }
}

Step to reproduce:

  1. Create both files with different names and one extension to compare: Новый_документ.docx and New_document.docx.

  2. Once both are created try to upload it using postman with attachment key

  1. Debug the data and have a look that formDataInput.getFormDataMap() method called dataMap returns really strange key that is encoded with UTF-8 and it’s cut because it has .doc instead of .docx. I suppose the key of the map is filename*=UTF-8 value that is taken from Content-Disposition header.
Content-Disposition: form-data; name="attachment"; filename="Новый_документ.docx"; filename*=UTF-8''%D0%9D%D0%BE%D0%B2%D1%8B%D0%B9_%D0%B4%D0%BE%D0%BA%D1%83%D0%BC%D0%B5%D0%BD%D1%82.docx

Inputs is null.

  1. Do the same with ASCII file name New_document.docx. And pay attention at the same map. For now there is expected key and Inputs isn’t null

So, my problem is: when I try to upload any file with non ASCII file name I can’t get attachment key from formDataInput.getFormDataMap() method result.
I tried to use several approaches to solve it:

  1. Was added
@Consumes(MediaType.MULTIPART_FORM_DATA + ";charset=utf-8")

instead of

@Consumes(MediaType.MULTIPART_FORM_DATA)
  1. Was added ContainerRequestFilter implementation:
package org.example;

import static org.jboss.resteasy.plugins.providers.multipart.InputPart.DEFAULT_CHARSET_PROPERTY;
import static org.jboss.resteasy.plugins.providers.multipart.InputPart.DEFAULT_CONTENT_TYPE_PROPERTY;

import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.container.ContainerRequestFilter;
import jakarta.ws.rs.ext.Provider;
import java.io.IOException;

@Provider
public class ContainerRequestFilterImpl implements ContainerRequestFilter {

    @Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        requestContext.setProperty(DEFAULT_CONTENT_TYPE_PROPERTY, "multipart/form-data;charset=utf-8");
        requestContext.setProperty(DEFAULT_CHARSET_PROPERTY, "utf-8");
    }
}

I have no idea already what I’ve done wrong and how to solve it

Used:

io.quarkus:quarkus-bom:3.13.0
org.jboss.resteasy:resteasy-multipart-provider:6.2.9.Final

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật