Skip to content

[Bug] PKCS12 file type validation not working #923

Open
@necik11

Description

@necik11

Is there an existing issue for this?

  • I have searched the existing issues

Have you updated FilePond and its plugins?

  • I have updated FilePond and its plugins

Describe the bug

Hi,

first of all I want to show that I found a similar topic/problem - ngx-filepond, I use react not angular and I have the same problem - but i didn't find any solution :)

I would try to elaborate a bit:

I'm trying to make my filepond accepts only pkcs12 (.pfx extension) files using filepond-plugin-file-validate-type. The expected behaviour is that when the dialog to select file opens, only .pfx files would be listed. However, no files are displayed.

I tried multiple ways:
1.

 <FilePond
            files={files}
            allowReorder={true}
            allowMultiple={false}
            allowFileTypeValidation={true}
            acceptedFileTypes={["application/x-pkcs12", "application/pkcs12"]}
          />

and on Q: "Can you confirm the file type the browser detects actually is 'application/x-pkcs12' with this util:" - yes i did. This is exactly the place where i found that i have to use x-pkcs12.
image

I try even fileValidateTypeDetectType but without attribute acceptedFilesTypes its again not working - not call :

 <FilePond
            files={files}
            allowReorder={true}
            allowMultiple={false}
            allowFileTypeValidation={true}
            fileValidateTypeDetectType={(source, type) =>
              new Promise((resolve, reject) => {
                // Do custom type detection here and return with promise
                console.log("source", source);
                console.log("type", type);
                resolve(type);
              })}
          />

and again after add:
acceptedFileTypes={["application/x-pkcs12"]}
stop working and i cant choose any file/certificate.

I even try:

       <FilePond
            files={files}
            allowReorder={true}
            allowMultiple={false}
            allowFileTypeValidation={true}
            acceptedFileTypes={["application/x-pkcs12", "application/x-x509-ca-cert"]}
          />

and this is funny cause its work, but just show certificate/files type .cer ...

Last try was add acceptedFileTypes empty with fileValidateTypeDetectType - i thought it will follow Promise resolve/reject:

    <FilePond
         files={files}
         allowReorder={true}
         allowMultiple={false}
         allowFileTypeValidation={true}
         acceptedFileTypes={[""]}
         fileValidateTypeDetectType={(source, type) =>
           new Promise((resolve, reject) => {
             // Do custom type detection here and return with promise
             console.log("source", source);
             console.log("type", type);
             resolve(type);
           })}
       />

But when i try upload cert its show error: this type is not supported, even there is explicit all resolve(type) ...

so i guess there is more then 3 years a bug which is not solved ? :)

Reproduction

Just install latest version of react-filepond filepond and filepond-plugin-file-validate-type .

Environment

- Device:
- OS: Windows 10
- Browser: Microsoft Edge

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions