Try specifying a Mime type. Here's an example of an onClick action where an image file is in the gateway's data folder.
Edit: I've also filed a ticket to look into making this a bit better.
from java.io import File
from com.inductiveautomation.ignition.gateway.util import MimeTypeUtils
fileName = 'data/image.png'
target = File(fileName)
if (target.exists()):
data = system.file.readFileAsBytes(fileName)
fileName = target.getName()
contentType = MimeTypeUtils.determineMimeType(fileName)
system.perspective.download(filename = fileName, data = data, contentType = contentType)```