Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] backgroundUpload crashes when no uploadType provided #259

Closed
1 of 2 tasks
jblarriviere opened this issue Dec 18, 2023 · 3 comments
Closed
1 of 2 tasks

[Android] backgroundUpload crashes when no uploadType provided #259

jblarriviere opened this issue Dec 18, 2023 · 3 comments
Labels

Comments

@jblarriviere
Copy link

jblarriviere commented Dec 18, 2023

Hi ! Thanks for working on this project, we're very happy with ! Here is a bug I noticed.
I'm happy to work on a PR, just let me know if I should handle the default value on the TS side or in the Android implem (or both) !

Current behavior

Calling backgroundUpload without providing and uploadType in the uploader options throws a NoSuchKeyException: uploadType error on Android

Expected behavior

Calling backgroundUpload without uploadType should not throw. uploadType should default to UploadType.BINARY_CONTENT as expected when reading the types (and as implemented in iOS)

export declare type UploaderOptions = (
  | {
      uploadType?: UploadType.BINARY_CONTENT;
      mimeType?: string;
    }
  | {
      uploadType: UploadType.MULTIPART;
      fieldName?: string;
      mimeType?: string;
      parameters?: Record<string, string>;
    }
) & {
  headers?: Record<string, string>;
  httpMethod?: UploaderHttpMethod;
  getCancellationId?: (cancellationId: string) => void;
};

Platform

  • Android
  • iOS

React Native Version

0.72.7

React Native Compressor Version

1.8.22

Reproducible Steps And Demo

Run example app on Android with line 255 of example/src/Screens/Video/index.tsx commented out. => No TS error
Navigate to Video Screen and try any Upload(PUT) button
See result here

(Should happen without any code modification on the exampleExpo app but I did not manage to build it)

Copy link

👋 @jblarriviere
Thanks for opening your issue here! If you find this package useful hit the star🌟!

Copy link

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Dec 18, 2024
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

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

No branches or pull requests

1 participant