From 8cfb8a25685c6081764b7d026bd9d2fc7dd2fad2 Mon Sep 17 00:00:00 2001 From: Viras- Date: Fri, 13 Sep 2013 18:38:48 +0200 Subject: [PATCH] fixing base64 helper function clobber for wp7 [CB-4668] fixing FileTransfer code to work in wp7 and be safe for headers which contain ':' --- plugin.xml | 2 +- src/wp/FileTransfer.cs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugin.xml b/plugin.xml index 84253ce..dd08a19 100644 --- a/plugin.xml +++ b/plugin.xml @@ -69,7 +69,7 @@ - + diff --git a/src/wp/FileTransfer.cs b/src/wp/FileTransfer.cs index 6cc1e1f..8b03d85 100644 --- a/src/wp/FileTransfer.cs +++ b/src/wp/FileTransfer.cs @@ -328,15 +328,18 @@ namespace WPCordovaClassLib.Cordova.Commands string[] strHeaders = temp.Split(','); for (int n = 0; n < strHeaders.Length; n++) { - string[] split = strHeaders[n].Split(':'); - if (split.Length == 2) + // we need to use indexOf in order to WP7 compatible + int splitIndex = strHeaders[n].IndexOf(':'); + if (splitIndex > 0) { + string[] split = new string[2]; + split[0] = strHeaders[n].Substring(0, splitIndex); + split[1] = strHeaders[n].Substring(splitIndex + 1); + split[0] = JSON.JsonHelper.Deserialize(split[0]); split[1] = JSON.JsonHelper.Deserialize(split[1]); result[split[0]] = split[1]; } - - } return result; }