You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by vi...@apache.org on 2013/09/13 19:23:14 UTC
[5/5] git commit: fixing base64 helper function clobber for wp7
[CB-4668] fixing FileTransfer code to work in wp7 and be safe for headers
which contain ':'
fixing base64 helper function clobber for wp7
[CB-4668] fixing FileTransfer code to work in wp7 and be safe for headers which contain ':'
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/commit/8cfb8a25
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/8cfb8a25
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/8cfb8a25
Branch: refs/heads/master
Commit: 8cfb8a25685c6081764b7d026bd9d2fc7dd2fad2
Parents: 6bd367c
Author: Viras- <vi...@users.sourceforge.net>
Authored: Fri Sep 13 18:38:48 2013 +0200
Committer: Viras- <vi...@users.sourceforge.net>
Committed: Fri Sep 13 18:38:48 2013 +0200
----------------------------------------------------------------------
plugin.xml | 2 +-
src/wp/FileTransfer.cs | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/8cfb8a25/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 84253ce..dd08a19 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -69,7 +69,7 @@
<source-file src="src/wp/FileTransfer.cs" />
<js-module src="www/wp7/base64.js" name="base64">
- <clobbers target="window.FileTransfer" />
+ <clobbers target="window.FileTransferBase64" />
</js-module>
</platform>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/8cfb8a25/src/wp/FileTransfer.cs
----------------------------------------------------------------------
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<string>(split[0]);
split[1] = JSON.JsonHelper.Deserialize<string>(split[1]);
result[split[0]] = split[1];
}
-
-
}
return result;
}