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

fix(react-native): support direct uploads through FormData #307

Merged
merged 4 commits into from
Mar 16, 2021

Conversation

nd0ut
Copy link
Member

@nd0ut nd0ut commented Mar 11, 2021

Fixes #306

Description

We upload small files through XHR and FormData. React-Native has its own implementation of XHR, FormData, Blobs, Files and everything else. And FormData for some reason doesn't support Blob arguments, instead it takes an object of type { name?: string; type?: string; uri: string } (see https://github.com/facebook/react-native/blob/master/Libraries/Network/FormData.js#L37)

@nd0ut nd0ut requested a review from FilippovAM March 11, 2021 08:09
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Mar 11, 2021

This pull request introduces 1 alert when merging cee8588 into 2c5dbf8 - view on LGTM.com

new alerts:

  • 1 for Superfluous trailing arguments

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Mar 11, 2021

This pull request introduces 1 alert when merging 43c50a4 into 2c5dbf8 - view on LGTM.com

new alerts:

  • 1 for Superfluous trailing arguments

@nd0ut nd0ut changed the title fix: support direct uploads through FormData under react-native runtime fix(react-native): support direct uploads through FormData Mar 15, 2021
@nd0ut nd0ut requested a review from foxeyes March 15, 2021 20:40
@nd0ut nd0ut mentioned this pull request Mar 15, 2021
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Mar 16, 2021

This pull request introduces 1 alert when merging 59d1be1 into 7606df9 - view on LGTM.com

new alerts:

  • 1 for Superfluous trailing arguments

@@ -9,24 +9,26 @@ import { BrowserFile, NodeFile } from '../request/types'
* in browsers.
*/

type FileTuple = ['file', BrowserFile | NodeFile, string]
type FileTriple = ['file', BrowserFile | NodeFile, string]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo?
FileTripple => FileTuple?

isFileTriple(tuple)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FilippovAM

This is not typo, triple is 3-tuple. I thought it was better to call this type triple, but now I think it's better to left it as it was. So I reverted it back.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Mar 16, 2021

This pull request introduces 1 alert when merging be65ca0 into 589ddbe - view on LGTM.com

new alerts:

  • 1 for Superfluous trailing arguments

@nd0ut nd0ut merged commit 428b039 into master Mar 16, 2021
@nd0ut nd0ut deleted the fix/react-native-direct-upload branch March 16, 2021 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

React Native Issue uploading smaller files
3 participants