Updated Branches:
  refs/heads/master 0a978a661 -> d1b8a3aec

Fixed two bugs concerning file uploads.

The first bug is in regards to line 129, where there is no default
value set for fileKey when it is not specified.

The second bug is in regards to the setting of the target and source
values for the FileTransferDelegate. The values are switched leading to
incorrect error messages.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/d1b8a3ae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/d1b8a3ae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/d1b8a3ae

Branch: refs/heads/master
Commit: d1b8a3aec92a446595a5fbfc7b98a0e6f36dc8d4
Parents: 0a978a6
Author: Anthony Gonzalez <adg...@me.com>
Authored: Fri Oct 12 20:07:35 2012 -0400
Committer: Andrew Grieve <agri...@chromium.org>
Committed: Mon Oct 15 13:15:31 2012 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVFileTransfer.m |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/d1b8a3ae/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m 
b/CordovaLib/Classes/CDVFileTransfer.m
index 15045f6..ee42c6b 100644
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -126,7 +126,7 @@ static CFIndex WriteDataToStream(NSData* data, 
CFWriteStreamRef stream)
     NSArray* arguments = command.arguments;
     NSString* target = (NSString*)[arguments objectAtIndex:0];
     NSString* server = (NSString*)[arguments objectAtIndex:1];
-    NSString* fileKey = (NSString*)[arguments objectAtIndex:2];
+    NSString* fileKey = [arguments objectAtIndex:2 withDefault:@"file"];
     NSString* fileName = [arguments objectAtIndex:3 
withDefault:@"no-filename"];
     NSString* mimeType = [arguments objectAtIndex:4 withDefault:nil];
     NSDictionary* options = [arguments objectAtIndex:5 withDefault:nil];
@@ -243,7 +243,7 @@ static CFIndex WriteDataToStream(NSData* data, 
CFWriteStreamRef stream)
 
 - 
(CDVFileTransferDelegate*)delegateForUploadCommand:(CDVInvokedUrlCommand*)command
 {
-    NSString* target = [command.arguments objectAtIndex:0];
+    NSString* source = [command.arguments objectAtIndex:0];
     NSString* server = [command.arguments objectAtIndex:1];
     NSString* objectId = [command.arguments objectAtIndex:9];
 
@@ -253,8 +253,8 @@ static CFIndex WriteDataToStream(NSData* data, 
CFWriteStreamRef stream)
     delegate.callbackId = command.callbackId;
     delegate.direction = CDV_TRANSFER_UPLOAD;
     delegate.objectId = objectId;
-    delegate.source = server;
-    delegate.target = target;
+    delegate.source = source;
+    delegate.target = server;
     return delegate;
 }
 

Reply via email to