Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrictions should be enforced before calling onBeforeUpload #1545

Closed
rajsite opened this issue May 12, 2019 · 2 comments
Closed

Restrictions should be enforced before calling onBeforeUpload #1545

rajsite opened this issue May 12, 2019 · 2 comments
Assignees

Comments

@rajsite
Copy link

rajsite commented May 12, 2019

When using restrictions, the maxNumberOfFiles, allowedFileTypes, etc are useful because they validate on file add which happens before the upload button is pressed.

However, the minNumberOfFiles restriction is validated in upload but after the onBeforeUpload check is called.

So in my onBeforeUpload check I am getting files that have only passed some of the restrictions. Instead, I think all of the restrictions should be validated before validating with the user's onBeforeUpload call.

arturi added a commit that referenced this issue May 24, 2019
…Added and onBeforeUpload callbacks

Addresses #1545, but I’m not sure this is the right move. Is it better to check restrictions before or after the callbacks?
@arturi
Copy link
Contributor

arturi commented Jul 16, 2019

Hi! Thanks for your input. I’ve first tried to do what you suggested — validate everything before callbacks, and also pass the file file objects to the callback. But upon discussion we’ve realized that since we are past 1.0, this would be a breaking change, so we decided to only implement minor changes in #1726, and not touch the order in which restrictions are checked. We might revisit this for 2.0.

@arturi arturi closed this as completed Jul 16, 2019
@rajsite
Copy link
Author

rajsite commented Oct 31, 2019

Thanks for looking into the behavior! Do you know if this is still on the roadmap for 2.0?

Alternatively could a different callback be included that runs after the validation steps but still before upload occurs? I'd like to leverage Uppy's normalization and filtering before adding some additional steps on top.

vymao pushed a commit to vymao/uppy that referenced this issue Mar 29, 2022
…Added and onBeforeUpload callbacks

Addresses transloadit#1545, but I’m not sure this is the right move. Is it better to check restrictions before or after the callbacks?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants