mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-05-17 00:00:03 +08:00
fixing base64 helper function clobber for wp7
[CB-4668] fixing FileTransfer code to work in wp7 and be safe for headers which contain ':'
This commit is contained in:
+1
-1
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user