Browse Source

Merge pull request #182 from TeletronicsDotAe/issue-181

multipart/form-data should use quoted-string syntax
wkh237 8 years ago
parent
commit
bd118af784
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      src/android/src/main/java/com/RNFetchBlob/RNFetchBlobBody.java

+ 2
- 2
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobBody.java View File

196
             // form begin
196
             // form begin
197
             String header = "--" + boundary + "\r\n";
197
             String header = "--" + boundary + "\r\n";
198
             if (field.filename != null) {
198
             if (field.filename != null) {
199
-                header += "Content-Disposition: form-data; name=" + name + "; filename=" + field.filename + "\r\n";
199
+                header += "Content-Disposition: form-data; name=\"" + name + "\"; filename=" + field.filename + "\r\n";
200
                 header += "Content-Type: " + field.mime + "\r\n\r\n";
200
                 header += "Content-Type: " + field.mime + "\r\n\r\n";
201
                 os.write(header.getBytes());
201
                 os.write(header.getBytes());
202
                 // file field header end
202
                 // file field header end
235
             }
235
             }
236
             // data field
236
             // data field
237
             else {
237
             else {
238
-                header += "Content-Disposition: form-data; name=" + name + "\r\n";
238
+                header += "Content-Disposition: form-data; name=\"" + name + "\"\r\n";
239
                 header += "Content-Type: " + field.mime + "\r\n\r\n";
239
                 header += "Content-Type: " + field.mime + "\r\n\r\n";
240
                 os.write(header.getBytes());
240
                 os.write(header.getBytes());
241
                 byte[] fieldData = field.data.getBytes();
241
                 byte[] fieldData = field.data.getBytes();