fredrik-corneliusson/click-web

Unable to use directories as input to `click.Path(file_okay=False, dir_ok=True)`

Closed this issue · 1 comments

The file picker (at least on Firefox/Ubuntu 18.08) doesn't allow choosing a directory, which is probably due to there not being a web API for it. A workaround might be to show a text input as a fallback which is not ideal but I don't know that there's really a good solution here due to the limitations of the web platform.

Hi,
thanks for the feedback.
If the goal is to upload a directory click-web expects the directory you want to process to be uploaded as a zip-file.
How it works:
click-web will then extract the content of the zip in it's temp directory and give that temporary path to the script. After the script finishes (done the processing of the directory) it will zip that directory and provide a download link in the response.
Providing a text input would not work unless you are on the same machine and it would be a dangerous vulnerability if you can make scripts process any folder on the server from the web.

Please let me know if this answers your question.

Cheers,
Fredrik