Probably a bug, i encounter the same problem, security and inherited access rules are set accordingly.
A workaround for a JSON file/other (small) files was;
1) decode your file to base64
2) create a variable with that decoded base64
3) generate a file by using base64tofile