When uploading .xlsx files via multipart form in Quarkus 3.10.2 (Java 17), the saved files becomes corrupted. Excel shows "We found a problem with some content" error when opening them. The files are 30-40% larger than the originals, while other file types work fine.
Key Symptoms:
- Files appear to upload successfully
- Saved .xlsx files are unreadable in Excel
- File sizes increase by ~40% (e.g., 100KB → 140KB)
- Images also affected, but text/PDF files work normally
I'm using:
- Quarkus: 3.10.2
- Java: Amazon Corretto 17
- OS: Windows 11 & Linux (both affected)
- Storage: Local filesystem (ext4/NTFS)
Code:
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadExcel(@RestForm("file") FileUpload file) throws IOException {
Path dest = Path.of("uploads", file.fileName());
// DEBUG: Log file sizes
System.out.printf("Original: %d bytes | Received: %d bytes%n",
file.size(),
Files.size(file.uploadedFile()));
Files.copy(file.uploadedFile(), dest, StandardCopyOption.REPLACE_EXISTING);
return Response.ok().build();
}