What I’m trying to do:
Provide a file for download to my users that retains the ending “.apkg” when downloaded. This already works on most browsers (Brave, Edge on Windows 10), but when I try to download the file on my Android phone, both Edge and Brave will add “.zip” to the specified filename (i.e. “Test.apkg.zip”). This is not completely wrong as an apkg file is a kind of zip file, but it is a problem because it makes it harder to import the file in the target app.
Example (will download a file called “Test.apkg”):
https://ga4juvmpt2porjvr.anvil.app/_/private_api/XPUG7NG3DYVAKZOZIXUXGIP5/dl/
What I’ve tried and what’s not working:
I created this app to showcase the problem:
Code Sample:
@anvil.server.http_endpoint("/dl/")
def dl_file(**params):
dl = app_tables.dls.get(name='test')
r = anvil.server.HttpResponse()
r.headers['content-disposition'] = 'attachment; filename="{}"'.format(dl['content'].name )
r.body = dl['content']
return r
Clone link:
https://anvil.works/build#clone:GA4JUVMPT2PORJVR=UUC7BQZ2AXAZMQR73AAF7R5S