Chrome headless replaces downloaded file with ‘download’

We moved our CI/CD to Docker, and currently run our selenium tests inside docker container. All tests are ok except tests that download files.
Locally (also in headless) those tests works fine, but inside docker chrome download files with name ‘download’

Code that triggers download

 const a = document.createElement('a');
 // eslint-disable-next-line no-param-reassign
 mimeType = mimeType || 'application/octet-stream';

 a.href = URL.createObjectURL(new Blob([content], {
   type: mimeType,
 console.log('megagon', fileName);
 a.setAttribute('download', fileName); = fileName;

setup headless chrome

        'download.default_directory': pathToDownload,
        'download.prompt_for_download': false,
        'download.directory_upgrade': true,
        'safebrowsing.enabled': false,
        'safebrowsing.disable_download_protection': true,

any ideas why chrome can behave like this?

Source: StackOverflow