[Python] Why is the Download Filename in Chrome is different than what is in the actual...

Discussão em 'Python' iniciado por Stack, Agosto 10, 2025.

  1. Stack

    Stack Membro Participativo

    So the code it

    return send_file(
    io.BytesIO(docorrection.text.encode()),
    mimetype = 'text/csv',
    as_attachment=True,
    download_name='corrected_addresses_'+formatted_time+'.csv',
    cache_timeout= 0
    )


    Which in the headers it states


    cache-control public, max-age=0 connection close content-disposition attachment; filename=corrected_addresses_2025_08_10_18_10_16.csv content-length 127 content-type text/csv; charset=utf-8 date Sun, 10 Aug 2025 22:10:16 GMT expires 0 pragma no-cache
    ​

    however the downloaded file is always corrected_addresses.txt which was what it was the first time I did it before I changed the code.... and yes I restarted the FLASK app..

    Continue reading...

Compartilhe esta Página