File download does not download the file when type id PDF, but seems to work for OCTET_STREAM

Hi
I am trying to initiate a pdf file download from a button. The generation can take a few seconds. If the generation is fast enough I am able to download the PDF. If the file takes too long to generate, the PDF is not downloaded (the “activity bar” on top is not blinking anymore, no exception are logged, but the fiel is not downloaded.

Here is the code to reproduce (maybe delay can differ?)

        byte[] buffer = new byte[6026767];
        Date now = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm");
        String generationDate = sdf.format(now);
        Thread.sleep(15000);
        downloader.download(buffer, "MyFile_" + generationDate + ".pdf", DownloadFormat.PDF);

If I change the DownloadFormat to OCTET_STREAM it appears to work correctly (but does not open the file in a tab).
Thanks for your help!
Thierry

Hello!

I tried your code to reproduce the issue but without success. Chrome and FireFox always show PDF file. I also changed the delay to 30 and still able to download PDF file.
Tried with Jmix 1.4.4+.