You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/03/12 23:57:51 UTC

[2/3] ios commit: Fixed CB-300 - CDVFileTransfer crashes with 303 and empty response

Fixed CB-300 - CDVFileTransfer crashes with 303 and empty response


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/234319a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/234319a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/234319a1

Branch: refs/heads/master
Commit: 234319a18ab925382b3a872e9593c64c2afd9bb5
Parents: 9a94dde
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Mar 12 14:59:05 2012 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Mar 12 14:59:05 2012 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/234319a1/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m b/CordovaLib/Classes/CDVFileTransfer.m
index 7d15da8..7e75592 100644
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -249,7 +249,9 @@
     NSString* response = [[NSString alloc] initWithData:self.responseData encoding:NSUTF8StringEncoding];
     // create dictionary to return FileUploadResult object
     NSMutableDictionary* uploadResult = [NSMutableDictionary dictionaryWithCapacity:3];
-    [uploadResult setObject: [response stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] forKey: @"response"];
+    if (response != nil) {
+        [uploadResult setObject: [response stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] forKey: @"response"];
+    }
     [uploadResult setObject:[NSNumber numberWithInt: self.bytesWritten] forKey:@"bytesSent"];
     [uploadResult setObject:[NSNull null] forKey: @"responseCode"];
     CDVPluginResult* result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsDictionary: uploadResult cast: @"navigator.fileTransfer._castUploadResult"];