diff --git a/src/android/FileTransfer.java b/src/android/FileTransfer.java index 22a1ed7..610ffe9 100644 --- a/src/android/FileTransfer.java +++ b/src/android/FileTransfer.java @@ -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)); }