pqina / filepond-plugin-file-rename

🏷 File rename plugin for FilePond
MIT License
6 stars 3 forks source link

Can't Cancel File Addition #17

Closed Gofilord closed 1 year ago

Gofilord commented 1 year ago

I chose to have my rename function return a promise, that when fulfilled returns a string with the new name. Which is a great API! However, I expect that if my promise rejects (for example, because the promise opened a prompt and the user clicked "cancel"), then the file would simply not be added.

Currently promise rejects are ignored.

rikschennink commented 1 year ago

It's a rename plugin, not a file validation plugin. I think a reject in this case should continue and just not rename the file?

Gofilord commented 1 year ago

Thanks for the quick response! I get that the purpose is to rename, but what if the user saw the prompt and decided not to continue? Can we have a different way of cancelling the file upload through this function?

rikschennink commented 1 year ago

I think to achieve that the fastest approach is to fork the plugin and adjust the logic.

Gofilord commented 1 year ago

I tried to, but couldn't prevent the file from being uploaded through the plugin (because I don't really know the inner interfaces with the core library). That's why I opened the issue :)

rikschennink commented 1 year ago

I believe you can dispatch a REMOVE_FILE event, best to search a bit in the FilePond source.

Gofilord commented 1 year ago

ok thanks.