Skip to content

Parsed File shape is incorrect on certain platforms #333

Open
@paul-vd

Description

@paul-vd

After debugging a cordova instance of a web app, we ran into an issue with the file uploader, we found the error to be in the AjaxUploader.tsx

Here is the patch that we had to apply to fix the issue:

diff --git a/node_modules/rc-upload/es/AjaxUploader.js b/node_modules/rc-upload/es/AjaxUploader.js
index 34509ce..2d5a577 100644
--- a/node_modules/rc-upload/es/AjaxUploader.js
+++ b/node_modules/rc-upload/es/AjaxUploader.js
@@ -219,13 +219,15 @@ var AjaxUploader = /*#__PURE__*/function (_Component) {
                 // Not sure if this will work since no related test case works with it
                 (_typeof(transformedFile) === 'object' || typeof transformedFile === 'string') && transformedFile ? transformedFile : file;
 
-                if (parsedData instanceof File) {
-                  parsedFile = parsedData;
-                } else {
-                  parsedFile = new File([parsedData], file.name, {
-                    type: file.type
-                  });
-                }
+                parsedFile = parsedData;
+
+                // if (parsedData instanceof File) {
+                //   parsedFile = parsedData;
+                // } else {
+                //   parsedFile = new File([parsedData], file.name, {
+                //     type: file.type
+                //   });
+                // }
 
                 mergedParsedFile = parsedFile;
                 mergedParsedFile.uid = file.uid;

Screenshots

Here is the debug point that triggered the parsed file change:

image

The mergedParsedFile's name becomes a [File] and the reset of the object is malformated:

image

Setup

antd: v4.16.2
Platform: Android 8.1
Cordova: v10
Cordova Android: v9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions