fine-uploader icon indicating copy to clipboard operation
fine-uploader copied to clipboard

dragging a large directory ignores `validation.itemLimit`

Open nalbion opened this issue 8 years ago • 3 comments

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 avatar Jul 13 '17 05:07 nalbion

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);
        };

nalbion avatar Jul 13 '17 07:07 nalbion

Have you looked into upstreaming this change into FineUploader?

bradleyayers avatar Mar 23 '18 00:03 bradleyayers

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?

Michael-Overall avatar Oct 04 '18 02:10 Michael-Overall