mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-04-28 00:02:49 +08:00
CB-6503: Null pointer check for headers in upload (This closes #27)
This commit is contained in:
@@ -343,7 +343,7 @@ public class FileTransfer extends CordovaPlugin {
|
||||
conn.setRequestMethod(httpMethod);
|
||||
|
||||
// if we specified a Content-Type header, don't do multipart form upload
|
||||
boolean multipartFormUpload = !headers.has("Content-Type");
|
||||
boolean multipartFormUpload = (headers == null) || !headers.has("Content-Type");
|
||||
if (multipartFormUpload) {
|
||||
conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user