holoviz / panel

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

FileDropper accepted_filetypes doesn't seem to properly validate #7153

Open ahuang11 opened 3 months ago

ahuang11 commented 3 months 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 months ago

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

ahuang11 commented 3 months 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 months 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.

CyberQin commented 2 months ago

This problem is still exists when v1.5.0 published.

MarcSkovMadsen commented 1 month ago

To solve this problem for our users we could convert know file suffixes to mime types.