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

core: Restrictions improvements #1726

Merged
merged 5 commits into from
Jul 15, 2019
Merged

core: Restrictions improvements #1726

merged 5 commits into from
Jul 15, 2019

Conversation

arturi
Copy link
Contributor

@arturi arturi commented Jul 11, 2019

This PR:

  • Sets file.type to the one detected by Uppy, before calling onBeforeFileAdded callback. This way you’ll get a meaningful type in the callback, instead of an empty string or an incorrect one.
  • Emits restriction-failed for minNumberOfFiles, too (so in uppy.upload()). Not sure about the signature in this case, it is (file, err) for when a file restriction fails, and I made it (null, err) for when it’s minNumberOfFiles.
  • Only logs non-restriction errors when “Upload” is pressed in StatusBar. For that, return Promise.reject() had to be changed to throwPromise.reject wasn’t caught in .catch(). Without this it throws an error in console.
  • Checks and throws early if restrictions.allowedFileTypes is not an array.

This PR supersedes #1594, since we’ve decided it has breaking changes.

Closes #1594

Copy link
Contributor

@goto-bus-stop goto-bus-stop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants