[
https://issues.apache.org/jira/browse/CB-6503?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14046714#comment-14046714
]
ASF GitHub Bot commented on CB-6503:
------------------------------------
Github user clelland commented on a diff in the pull request:
https://github.com/apache/cordova-plugin-file-transfer/pull/27#discussion_r14322195
--- Diff: src/android/FileTransfer.java ---
@@ -315,8 +315,13 @@ public void run() {
// Use a post method.
conn.setRequestMethod(httpMethod);
- conn.setRequestProperty("Content-Type",
"multipart/form-data; boundary=" + BOUNDARY);
-
+
+ // if we specified a Content-Type header, don't do
multipart form upload
+ boolean multipartFormUpload =
!headers.has("Content-Type");
--- End diff --
I've added a null check here -- headers is not necessarily populated by
this point. (same on amazon)
> allow file uploads to be sent directly, rather than only as multipart form
> data
> -------------------------------------------------------------------------------
>
> Key: CB-6503
> URL: https://issues.apache.org/jira/browse/CB-6503
> Project: Apache Cordova
> Issue Type: Improvement
> Components: Plugin File Transfer
> Affects Versions: 3.3.0
> Reporter: M C
> Priority: Minor
>
> > > on iOS, Android and Amazon, if upload has a header named Content-Type,
> > > multipart form data will NOT be used
> > I understand the problem, but wouldn't it be better if we just filtered out
> > "Content-Type" for user-defined headers? (disallow setting it)
> In this use case, direct upload without the multipart encoding is desirable,
> so disallowing the header and forcing multipart upload would have the
> opposite effect of what was needed.
--
This message was sent by Atlassian JIRA
(v6.2#6252)