CSV Download in 1.19.0 retureing 'file' type, not csv

Summary

In the new 1.19 update downloading a csv file is not showing up as a .csv file but just as a โ€œfileโ€.

Steps to reproduce

Code snippet:


import pandas as pd
import streamlit as st



def convert_df(df):
    """
    converts df to csv
    :param df: df to make csv
    :return: df in csv
    """
    return df.to_csv(index=False)


def download_button(filename, data):
    st.download_button(
        label="Download Output File",
        data=data,
        file_name=filename,
        mime='text/csv',
        )
    

df = pd.DataFrame([1, 2, 3])

converted_df = convert_df(df)
download_button('testdf', converted_df)

I am expecting a csv file, not a โ€œfileโ€.

Debug info

  • Streamlit version: โ€˜1.19.0โ€™
  • Python version: 3.10.6
  • Pandas version โ€˜1.4.3โ€™

Prior to this version it was working fine.

image
image

What about:

download_button('testdf.csv', converted_df)