From a4a448095c02a658c2e1fdcff267d5d3de5785f3 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Tue, 8 Sep 2015 14:04:04 -0700 Subject: [PATCH] CB-9624: There's a difference between what's being passed in and what should actually be sent to the File Transfer plugin --- src/android/FileTransfer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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)); }