holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.62k stars 504 forks source link

FileDropper accepted_filetypes doesn't seem to properly validate #7153

Open ahuang11 opened 3 weeks ago

ahuang11 commented 3 weeks ago
import panel as pn

pn.extension()

self._file_input = pn.widgets.FileDropper(
    multiple=True,
    accepted_filetypes=[".csv", ".parquet", ".parq", ".json", ".xlsx"],
)
image
hoxbro commented 3 weeks ago

What happens if you pass in without the dots? E.g. csv instead of .csv.

ahuang11 commented 3 weeks ago

Still fails

import panel as pn

pn.extension()

pn.widgets.FileDropper(
    multiple=True,
    accepted_filetypes=["csv", "parquet", "parq", "json", "xlsx"],
).show()
image
philippjfr commented 3 weeks ago

Seems like a problem with Filepond itself: https://github.com/pqina/filepond-plugin-file-validate-type/issues/13

Problem is that it passes the accept keyword down to the DOM node, which does support file extensions but the FilePond validation logic itself expects mime types.