CB-9624: There's a difference between what's being passed in and what should actually be sent to the File Transfer plugin

This commit is contained in:
Joe Bowser
2015-09-08 14:04:04 -07:00
parent 8fcdb1aa3d
commit a4a448095c
+3 -2
View File
@@ -204,7 +204,7 @@ public class FileTransfer extends CordovaPlugin {
* arbitrary characters, but we donon- not do that encoding here.
*/
String headerKey = iter.next().toString();
headerKey = headerKey.replaceAll("\\n","")
String cleanHeaderKey = headerKey.replaceAll("\\n","")
.replaceAll("\\s+","")
.replaceAll(":", "")
.replaceAll("[^\\x20-\\x7E]+", "");
@@ -224,7 +224,8 @@ public class FileTransfer extends CordovaPlugin {
headerValues.put(finalValue);
}
connection.setRequestProperty(headerKey, headerValues.getString(0));
//Use the clean header key, not the one that we passed in
connection.setRequestProperty(cleanHeaderKey, headerValues.getString(0));
for (int i = 1; i < headerValues.length(); ++i) {
connection.addRequestProperty(headerKey, headerValues.getString(i));
}