Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

dragging a large directory ignores validation.itemLimit #1885

Open
nalbion opened this issue Jul 13, 2017 · 3 comments
Open

dragging a large directory ignores validation.itemLimit #1885

nalbion opened this issue Jul 13, 2017 · 3 comments

Comments

@nalbion
Copy link
Contributor

nalbion commented Jul 13, 2017

Type of issue

  • [*] Bug report

If you drag a large directory into FIneUploader (say, the fine-uploader root, after installing node_modules) Fine Uploader adds them all to qq.UploadData as "submitting", even if the number of files is larger than itemLimit

@nalbion
Copy link
Contributor Author

nalbion commented Jul 13, 2017

I've monkey-patched this in my application code:

    const _addFiles = this.uploader.addFiles.bind(this.uploader);
        this.uploader.addFiles = function(data, params, endpoint) {
            let uploads = self.uploader.getUploads(),
                remove = self.itemLimit - (uploads.length + data.length);
            if (remove) {
                data = data.slice(0, remove);
            }
            return _addFiles(data, params, endpoint);
        };

@bradleyayers
Copy link
Contributor

Have you looked into upstreaming this change into FineUploader?

@Michael-Overall
Copy link

How in depth would an appropriate pull request to fix this issue be?

For writing accompanying unit tests, test/unit/uploader.basic.api.js seems to use the Mocha unit test framework to ensure api functions set values correctly. It looks like tests have been implemented to either mock or use actual file uploads. What would be the preferred way to test limiting dropped files with these tools?

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

No branches or pull requests

3 participants