This repository was archived by the owner on Mar 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
src/android/src/main/java/com/RNFetchBlob Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -242,10 +242,10 @@ private ArrayList<FormField> countFormDataLength() {
242242 ArrayList <FormField > list = new ArrayList <>();
243243 ReactApplicationContext ctx = RNFetchBlob .RCTContext ;
244244 for (int i = 0 ;i < form .size (); i ++) {
245- ReadableMap field = form .getMap (i );
246- list .add (new FormField ( field ) );
247- String data = field .getString ( " data" ) ;
248- if (field .hasKey ( " filename" ) ) {
245+ FormField field = new FormField ( form .getMap (i ) );
246+ list .add (field );
247+ String data = field .data ;
248+ if (field .filename != null ) {
249249 // upload from storage
250250 if (data .startsWith (RNFetchBlobConst .FILE_PREFIX )) {
251251 String orgPath = data .substring (RNFetchBlobConst .FILE_PREFIX .length ());
@@ -274,7 +274,7 @@ private ArrayList<FormField> countFormDataLength() {
274274 }
275275 // data field
276276 else {
277- total += field .getString ( " data" ). length ();
277+ total += field .data != null ? field . data . length () : 0 ;
278278 }
279279 }
280280 contentLength = total ;
@@ -301,8 +301,9 @@ public FormField(ReadableMap rawData) {
301301 else {
302302 mime = filename == null ? "text/plain" : "application/octet-stream" ;
303303 }
304- if (rawData .hasKey ("data" ))
304+ if (rawData .hasKey ("data" )) {
305305 data = rawData .getString ("data" );
306+ }
306307 }
307308 }
308309
You can’t perform that action at this time.
0 commit comments