filestack-js icon indicating copy to clipboard operation
filestack-js copied to clipboard

v3.21.1 breaks `accept` picker option for .zip files

Open lmcnearney opened this issue 4 years ago • 8 comments

The latest release of the picker component (which doesn't appear to be a part of this repository) breaks handling of .zip files when used in the accept option. Rolling back to the prior release (v3.21.0) resolves the issue.

Reproducing the issue is simple - just pass .zip as an accept option to the picker and then try to upload a zip file. You will receive this validation error message (all client side):

zip

lmcnearney avatar Jan 29 '21 18:01 lmcnearney

The .mp3 extension for accept option also has the same error when recording the audio.

khoa88 avatar Feb 04 '21 06:02 khoa88

Hi, we are currently working on problems with accept option in picker

pcholuj avatar Mar 09 '21 09:03 pcholuj

I don't know if this is related. When I set accept to the following

[
  ".pdf",
  ".ppt",
  ".doc",
  ".odt",
  ".odp",
  ".docx",
  ".rtf",
  ".xls",
  ".xlsx",
  "image/*",
  "video/*",
  "audio/*",
  "text/plain",
  "text/csv"
]

I am still able to upload zip files

lukejpreston avatar Mar 12 '21 11:03 lukejpreston

@lukejpreston can you provide more info about how you are trying to upload files ? Browser, system and how are you uploading those files?

I use example https://jsfiddle.net/pcholuj/2ezrc70b/ and im unable to add zip file

pcholuj avatar Mar 12 '21 11:03 pcholuj

Thanks for the quick reply @pcholuj After seeing your jsfiddle I realised we were using an old version of the library. The latest version works fine (from v1 -> v3)

lukejpreston avatar Mar 12 '21 11:03 lukejpreston

I was opening a new bug, but I think this it's related to this bug:

Starting with Filestack-js 3.21.1, I have the following error when uploading an AVI file in a Filestack where the parameter accept is set to ["avi"].

"File drop.avi is not an accepted file type. The accepted file types are .avi"

The error only occur in Chrome. It works in Safari and Firefox. It also works if I rollback to the NPM version 3.21.0.

The error occur in the cdn file "/1.20.1/picker.js". It looks like it's trying to see if the file MimeType is part of "getters.acceptMime".

That MimeType value is "video/avi" in Chrome and "video/x-msvideo" in Safari.

It works in Chrome in the cdn 1.20.0 version because the following code (removed in 1.20.1) prevent the ERROR_FILE_NOT_ACCEPTABLE from being displayed.

if (!e.getters.customText)
    return !0;

ericm546 avatar Mar 19 '21 00:03 ericm546

To fix this problem we rolled back to 3.15.0 and used extensions. So far so good.

sshaw avatar Mar 27 '21 05:03 sshaw

The main problem with this is that firefox and chrome returns different mimetypes for avi files. There is much more problems with it so we decided to add posibility to provide your own acceptFn callback: https://jsfiddle.net/pcholuj/42pLfv0o/1/

pcholuj avatar Apr 01 '21 09:04 pcholuj