We have set up a private file system on a website based on drupal's guidelines. We are using Drupal 8.
We have setup the private file directory outsite of
/var/privatefiles. When downloading certain types of files - specifically docx - files are being corrupted. pdfs and other common types seem to be working fine.
File upload is working correctly as I am able to scp the files directly from the server and they are intact.
Additionally, on a test server made from a copy of the server we set up the private files inside the siteroot and that works without problem. This solution is not ideal however as we do not want the files to be accessible directly from the web.
I cannot find anything that discusses this issue, surely I am not the first person to set up a private directory this way and have docx files break?
Further testing indicates that what is occurring is that drupal or php are adding 3 newline
0a characters to the start of every file served from the private file system. It has np effect on some formats but all MS files - docx,xlsx etc - are broken.
How do I fix this?