panel icon indicating copy to clipboard operation
panel copied to clipboard

FileDropper accepted_filetypes doesn't seem to properly validate

Open ahuang11 opened this issue 1 year ago • 5 comments

import panel as pn

pn.extension()

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

ahuang11 avatar Aug 15 '24 22:08 ahuang11

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

hoxbro avatar Aug 16 '24 16:08 hoxbro

Still fails

import panel as pn

pn.extension()

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

ahuang11 avatar Aug 16 '24 16:08 ahuang11

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.

philippjfr avatar Aug 18 '24 09:08 philippjfr

This problem is still exists when v1.5.0 published.

CyberQin avatar Sep 19 '24 08:09 CyberQin

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

MarcSkovMadsen avatar Oct 16 '24 09:10 MarcSkovMadsen