You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/04/23 20:57:04 UTC

[01/11] git commit: CB-6114 Incremented plugin version on dev branch.

Repository: cordova-plugin-file-transfer
Updated Branches:
  refs/heads/master 05786ec2e -> 6a92b13cf


CB-6114 Incremented plugin version on dev branch.


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/f1153949
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/f1153949
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/f1153949

Branch: refs/heads/master
Commit: f115394912e08800d20ff6ca315b30e39562460d
Parents: 4d2c873
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Feb 27 12:29:15 2014 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Feb 28 16:29:11 2014 -0500

----------------------------------------------------------------------
 plugin.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/f1153949/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 30e9588..842081a 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -2,7 +2,7 @@
 <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
     id="org.apache.cordova.file-transfer"
-    version="0.4.2">
+    version="0.4.3-dev">
     <name>File Transfer</name>
     <description>Cordova File Transfer Plugin</description>
     <license>Apache 2.0</license>


[05/11] git commit: [ios] Cast id references to NSURL to avoid compiler warnings (Fixes: apache/cordova-plugin-file-transfer#18)

Posted by ia...@apache.org.
[ios] Cast id references to NSURL to avoid compiler warnings (Fixes: apache/cordova-plugin-file-transfer#18)


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/449df558
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/449df558
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/449df558

Branch: refs/heads/master
Commit: 449df558480b12afc048af01138be7c0d4f8699a
Parents: 653ec00
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Mar 21 11:22:46 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Fri Mar 21 11:23:11 2014 -0400

----------------------------------------------------------------------
 src/ios/CDVFileTransfer.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/449df558/src/ios/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVFileTransfer.m b/src/ios/CDVFileTransfer.m
index e35e262..3753993 100644
--- a/src/ios/CDVFileTransfer.m
+++ b/src/ios/CDVFileTransfer.m
@@ -293,7 +293,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
         return;
     } else {
         // Extract the path part out of a file: URL.
-        NSString* filePath = [source hasPrefix:@"/"] ? [source copy] : [[NSURL URLWithString:source] path];
+        NSString* filePath = [source hasPrefix:@"/"] ? [source copy] : [(NSURL *)[NSURL URLWithString:source] path];
         if (filePath == nil) {
             // We couldn't find the asset.  Send the appropriate error.
             CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[self createFileTransferError:NOT_FOUND_ERR AndSource:source AndTarget:server]];
@@ -646,7 +646,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
             filePath = [fs filesystemPathForURL:sourceURL];
         } else {
             // Extract the path part out of a file: URL.
-            NSString* filePath = [self.target hasPrefix:@"/"] ? [self.target copy] : [[NSURL URLWithString:self.target] path];
+            NSString* filePath = [self.target hasPrefix:@"/"] ? [self.target copy] : [(NSURL *)[NSURL URLWithString:self.target] path];
             if (filePath == nil) {
                 // We couldn't find the asset.  Send the appropriate error.
                 [self cancelTransferWithError:connection errorMessage:[NSString stringWithFormat:@"Could not create target file"]];


[04/11] git commit: [ios] Cleanup extra semicolons

Posted by ia...@apache.org.
[ios] Cleanup extra semicolons


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/653ec00f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/653ec00f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/653ec00f

Branch: refs/heads/master
Commit: 653ec00fa65528afba0a203f364600f8999ccc9f
Parents: 0f84287
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Mar 21 11:09:50 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Fri Mar 21 11:23:01 2014 -0400

----------------------------------------------------------------------
 src/ios/CDVFileTransfer.h | 2 +-
 src/ios/CDVFileTransfer.m | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/653ec00f/src/ios/CDVFileTransfer.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVFileTransfer.h b/src/ios/CDVFileTransfer.h
index aea9b2d..9c4bcf1 100644
--- a/src/ios/CDVFileTransfer.h
+++ b/src/ios/CDVFileTransfer.h
@@ -84,4 +84,4 @@ extern NSString* const kOptionsKeyCookie;
 @property (nonatomic, strong) CDVFileTransferEntityLengthRequest* entityLengthRequest;
 @property (nonatomic, strong) CDVFile *filePlugin;
 
-@end;
+@end

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/653ec00f/src/ios/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVFileTransfer.m b/src/ios/CDVFileTransfer.m
index 1e62438..e35e262 100644
--- a/src/ios/CDVFileTransfer.m
+++ b/src/ios/CDVFileTransfer.m
@@ -492,9 +492,9 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
 
 - (CDVFileTransferEntityLengthRequest*)initWithOriginalRequest:(NSURLRequest*)originalRequest andDelegate:(CDVFileTransferDelegate*)originalDelegate;
 
-@end;
+@end
 
-@implementation CDVFileTransferEntityLengthRequest;
+@implementation CDVFileTransferEntityLengthRequest
 
 - (CDVFileTransferEntityLengthRequest*)initWithOriginalRequest:(NSURLRequest*)originalRequest andDelegate:(CDVFileTransferDelegate*)originalDelegate
 {
@@ -765,4 +765,4 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
     return self;
 }
 
-@end;
+@end


[08/11] git commit: CB-6422 [windows8] use cordova/exec/proxy

Posted by ia...@apache.org.
CB-6422 [windows8] use cordova/exec/proxy


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/f2e56a2a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/f2e56a2a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/f2e56a2a

Branch: refs/heads/master
Commit: f2e56a2ac0ee85de15e1c95eaae2edcbc1c3f134
Parents: 2309e0e
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Apr 8 16:18:01 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Apr 8 16:18:01 2014 -0700

----------------------------------------------------------------------
 www/windows8/FileTransferProxy.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/f2e56a2a/www/windows8/FileTransferProxy.js
----------------------------------------------------------------------
diff --git a/www/windows8/FileTransferProxy.js b/www/windows8/FileTransferProxy.js
index 5c09805..fae6533 100644
--- a/www/windows8/FileTransferProxy.js
+++ b/www/windows8/FileTransferProxy.js
@@ -117,4 +117,4 @@ module.exports = {
     }
 };
 
-require("cordova/windows8/commandProxy").add("FileTransfer",module.exports);
+require("cordova/exec/proxy").add("FileTransfer",module.exports);


[06/11] git commit: [CB-5175] CDVFileTransfer asynchronous download (Fixes #24)

Posted by ia...@apache.org.
[CB-5175] CDVFileTransfer asynchronous download (Fixes #24)

Since download can take time, for it to be non-blocking, moved the call to a separate thread.


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/223d0862
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/223d0862
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/223d0862

Branch: refs/heads/master
Commit: 223d08626df36c0f386af3fe609d0a36c450d6d9
Parents: 449df55
Author: torrmal <jo...@gmail.com>
Authored: Wed Mar 26 11:58:26 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Thu Mar 27 13:21:26 2014 -0400

----------------------------------------------------------------------
 src/ios/CDVFileTransfer.m | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/223d0862/src/ios/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVFileTransfer.m b/src/ios/CDVFileTransfer.m
index 3753993..d87bb94 100644
--- a/src/ios/CDVFileTransfer.m
+++ b/src/ios/CDVFileTransfer.m
@@ -430,8 +430,12 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
     @synchronized (activeTransfers) {
         activeTransfers[delegate.objectId] = delegate;
     }
-
-    [delegate.connection start];
+    // Downloads can take time
+    // sending this to a new thread calling the download_async method
+    dispatch_async(
+                   dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL),
+                   ^(void) { [delegate.connection start];}
+                   );
 }
 
 - (NSMutableDictionary*)createFileTransferError:(int)code AndSource:(NSString*)source AndTarget:(NSString*)target


[10/11] git commit: CB-6452 Updated version and RELEASENOTES.md for release 0.4.3

Posted by ia...@apache.org.
CB-6452 Updated version and RELEASENOTES.md for release 0.4.3


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/8b727b2c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/8b727b2c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/8b727b2c

Branch: refs/heads/master
Commit: 8b727b2cfd295b55c200c58da2c16df509e97632
Parents: 9b85ae1
Author: Ian Clelland <ic...@chromium.org>
Authored: Thu Apr 17 10:53:20 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Thu Apr 17 10:53:20 2014 -0400

----------------------------------------------------------------------
 RELEASENOTES.md | 13 +++++++++++++
 plugin.xml      |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/8b727b2c/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 34da2ff..e982549 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -68,3 +68,16 @@
 * CB-6000 Android: Nginx rejects Content-Type without a space before "boundary".
 * CB-4907 Android: Close stream when we're finished with it
 * CB-6022 Add backwards-compatibility notes to doc
+
+### 0.4.3 (Apr 17, 2014)
+* CB-6422 [windows8] use cordova/exec/proxy
+* iOS: Fix error where files were not removed on abort
+* CB-5175: [ios] CDVFileTransfer asynchronous download (Fixes #24)
+* [ios] Cast id references to NSURL to avoid compiler warnings (Fixes: apache/cordova-plugin-file-transfer#18)
+* CB-6212: [iOS] fix warnings compiled under arm64 64-bit
+* CB-5762: [FireOS] android: Fix lengthComputable set wrong for gzip downloads
+* CB-5631: [FireOS] Removed SimpleTrackingInputStream.read(byte[] buffer)
+* CB-4907: [FireOS] Close stream when we're finished with it
+* CB-6000: [FireOS] Nginx rejects Content-Type without a space before "boundary".
+* CB-6050: [FireOS] Use instance method on actual file plugin object to get FileEntry to return on download
+* CB-6460: Update license headers

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/8b727b2c/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 552e588..a4f4346 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -21,7 +21,7 @@
 <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
     id="org.apache.cordova.file-transfer"
-    version="0.4.3-dev">
+    version="0.4.3">
     <name>File Transfer</name>
     <description>Cordova File Transfer Plugin</description>
     <license>Apache 2.0</license>


[11/11] git commit: Merge dev branch @ 'r0.4.3' into master for release

Posted by ia...@apache.org.
Merge dev branch @ 'r0.4.3' into master for release


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/6a92b13c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/6a92b13c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/6a92b13c

Branch: refs/heads/master
Commit: 6a92b13cf396de1dba7685f407a569db4d671f75
Parents: 05786ec 8b727b2
Author: Ian Clelland <ic...@chromium.org>
Authored: Wed Apr 23 14:38:55 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Wed Apr 23 14:38:55 2014 -0400

----------------------------------------------------------------------
 RELEASENOTES.md                   | 13 ++++++++
 plugin.xml                        | 21 ++++++++++++-
 src/ios/CDVFileTransfer.h         |  2 +-
 src/ios/CDVFileTransfer.m         | 56 ++++++++++++++++++++--------------
 www/windows8/FileTransferProxy.js |  2 +-
 5 files changed, 68 insertions(+), 26 deletions(-)
----------------------------------------------------------------------



[02/11] git commit: Upleveled from android port with following commits: 3c1ff16 Andrew Grieve - CB-5762 android: Fix lengthComputable set wrong for gzip downloads 8374b3d Colin Mahoney - CB-5631 Removed SimpleTrackingInputStream.read(byte[] buffer) 6f91a

Posted by ia...@apache.org.
Upleveled from android port with following commits:
3c1ff16 Andrew Grieve - CB-5762 android: Fix lengthComputable set wrong for gzip downloads
8374b3d Colin Mahoney - CB-5631 Removed SimpleTrackingInputStream.read(byte[] buffer)
6f91ac3 Bas Bosman - CB-4907 Close stream when we're finished with it
651460f Christoph Neumann - CB-6000 Nginx rejects Content-Type without a space before "boundary".
35f80e4 Ian Clelland - CB-6050: Use instance method on actual file plugin object to get FileEntry to return on download


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/c35ca1a5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/c35ca1a5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/c35ca1a5

Branch: refs/heads/master
Commit: c35ca1a5c22298542f84e372a3f9ff6da914a05b
Parents: f115394
Author: Archana Naik <na...@lab126.com>
Authored: Mon Mar 10 23:02:28 2014 -0700
Committer: Archana Naik <na...@lab126.com>
Committed: Mon Mar 10 23:02:28 2014 -0700

----------------------------------------------------------------------
 src/amazon/FileTransfer.java | 53 +++++++++++++++++++++++++--------------
 1 file changed, 34 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/c35ca1a5/src/amazon/FileTransfer.java
----------------------------------------------------------------------
diff --git a/src/amazon/FileTransfer.java b/src/amazon/FileTransfer.java
index 2e0c31c..513400e 100644
--- a/src/amazon/FileTransfer.java
+++ b/src/amazon/FileTransfer.java
@@ -158,11 +158,8 @@ public class FileTransfer extends CordovaPlugin {
             return updateBytesRead(super.read());
         }
 
-        @Override
-        public int read(byte[] buffer) throws IOException {
-            return updateBytesRead(super.read(buffer));
-        }
-
+        // Note: FilterInputStream delegates read(byte[] bytes) to the below method,
+        // so we don't override it or else double count (CB-5631).
         @Override
         public int read(byte[] bytes, int offset, int count) throws IOException {
             return updateBytesRead(super.read(bytes, offset, count));
@@ -318,7 +315,7 @@ public class FileTransfer extends CordovaPlugin {
 
                     // Use a post method.
                     conn.setRequestMethod(httpMethod);
-                    conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + BOUNDARY);
+                    conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
 
                     // Set the cookies on the response
                     String cookie = AmazonCookieManager.getInstance().getCookie(target);
@@ -585,15 +582,19 @@ public class FileTransfer extends CordovaPlugin {
                     if(err != null)
                     {
                         BufferedReader reader = new BufferedReader(new InputStreamReader(err, "UTF-8"));
-                        String line = reader.readLine();
-                        while(line != null)
-                        {
-                            bodyBuilder.append(line);
-                            line = reader.readLine();
-                            if(line != null)
-                                bodyBuilder.append('\n');
+                        try {
+                            String line = reader.readLine();
+                            while(line != null) {
+                                bodyBuilder.append(line);
+                                line = reader.readLine();
+                                if(line != null) {
+                                    bodyBuilder.append('\n');
+                                }
+                            }
+                            body = bodyBuilder.toString();
+                        } finally {
+                            reader.close();
                         }
-                        body = bodyBuilder.toString();
                     }
                 }
             // IOException can leave connection object in a bad state, so catch all exceptions.
@@ -760,8 +761,10 @@ public class FileTransfer extends CordovaPlugin {
                         if (connection.getContentEncoding() == null || connection.getContentEncoding().equalsIgnoreCase("gzip")) {
                             // Only trust content-length header if we understand
                             // the encoding -- identity or gzip
-                            progress.setLengthComputable(true);
-                            progress.setTotal(connection.getContentLength());
+                            if (connection.getContentLength() != -1) {
+                                progress.setLengthComputable(true);
+                                progress.setTotal(connection.getContentLength());
+                            }
                         }
                         inputStream = getInputStream(connection);
                     }
@@ -794,9 +797,21 @@ public class FileTransfer extends CordovaPlugin {
                     Log.d(LOG_TAG, "Saved file: " + target);
     
                     // create FileEntry object
-                    JSONObject fileEntry = FileUtils.getEntry(file);
-                    
-                    result = new PluginResult(PluginResult.Status.OK, fileEntry);
+                    FileUtils filePlugin = (FileUtils)webView.pluginManager.getPlugin("File");
+                    if (filePlugin != null) {
+                        JSONObject fileEntry = filePlugin.getEntryForFile(file);
+                        if (fileEntry != null) {
+                            result = new PluginResult(PluginResult.Status.OK, fileEntry);
+                        } else {
+                            JSONObject error = createFileTransferError(CONNECTION_ERR, source, target, connection);
+                            Log.e(LOG_TAG, "File plugin cannot represent download path");
+                            result = new PluginResult(PluginResult.Status.IO_EXCEPTION, error);
+                        }
+                    } else {
+                        Log.e(LOG_TAG, "File plugin not found; cannot save downloaded file");
+                        result = new PluginResult(PluginResult.Status.ERROR, "File plugin not found; cannot save downloaded file");
+                    }
+
                 } catch (FileNotFoundException e) {
                     JSONObject error = createFileTransferError(FILE_NOT_FOUND_ERR, source, target, connection);
                     Log.e(LOG_TAG, error.toString(), e);


[03/11] git commit: CB-6212 iOS: fix warnings compiled under arm64 64-bit

Posted by ia...@apache.org.
CB-6212 iOS: fix warnings compiled under arm64 64-bit


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/0f84287d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/0f84287d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/0f84287d

Branch: refs/heads/master
Commit: 0f84287df03e7372eebe1d8620f8a78bb4900b4e
Parents: c35ca1a
Author: James Jong <wj...@gmail.com>
Authored: Thu Mar 13 09:27:01 2014 -0400
Committer: James Jong <wj...@gmail.com>
Committed: Thu Mar 13 09:27:01 2014 -0400

----------------------------------------------------------------------
 src/ios/CDVFileTransfer.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/0f84287d/src/ios/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVFileTransfer.m b/src/ios/CDVFileTransfer.m
index f19bece..1e62438 100644
--- a/src/ios/CDVFileTransfer.m
+++ b/src/ios/CDVFileTransfer.m
@@ -58,7 +58,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
                 bytesToWrite - totalBytesWritten);
         if (result < 0) {
             CFStreamError error = CFWriteStreamGetError(stream);
-            NSLog(@"WriteStreamError domain: %ld error: %ld", error.domain, error.error);
+            NSLog(@"WriteStreamError domain: %ld error: %ld", error.domain, (long)error.error);
             return result;
         } else if (result == 0) {
             return result;
@@ -207,7 +207,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
     if (mimeType != nil) {
         [postBodyBeforeFile appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n", mimeType] dataUsingEncoding:NSUTF8StringEncoding]];
     }
-    [postBodyBeforeFile appendData:[[NSString stringWithFormat:@"Content-Length: %d\r\n\r\n", [fileData length]] dataUsingEncoding:NSUTF8StringEncoding]];
+    [postBodyBeforeFile appendData:[[NSString stringWithFormat:@"Content-Length: %ld\r\n\r\n", (long)[fileData length]] dataUsingEncoding:NSUTF8StringEncoding]];
 
     DLog(@"fileData length: %d", [fileData length]);
     NSData* postBodyAfterFile = [[NSString stringWithFormat:@"\r\n--%@--\r\n", kFormBoundary] dataUsingEncoding:NSUTF8StringEncoding];


[07/11] git commit: iOS: Fix error where files were not removed on abort

Posted by ia...@apache.org.
iOS: Fix error where files were not removed on abort


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/2309e0e7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/2309e0e7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/2309e0e7

Branch: refs/heads/master
Commit: 2309e0e76ca7f4db63e273be75dfd7332b6eb824
Parents: 223d086
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Mar 28 10:36:01 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Fri Mar 28 10:36:01 2014 -0400

----------------------------------------------------------------------
 src/ios/CDVFileTransfer.m | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/2309e0e7/src/ios/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVFileTransfer.m b/src/ios/CDVFileTransfer.m
index d87bb94..a1eeef2 100644
--- a/src/ios/CDVFileTransfer.m
+++ b/src/ios/CDVFileTransfer.m
@@ -587,7 +587,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
 {
     NSFileManager* fileMgr = [NSFileManager defaultManager];
 
-    [fileMgr removeItemAtPath:self.target error:nil];
+    [fileMgr removeItemAtPath:[self targetFilePath] error:nil];
 }
 
 - (void)cancelTransfer:(NSURLConnection*)connection
@@ -612,6 +612,21 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
     [self.command.commandDelegate sendPluginResult:result callbackId:callbackId];
 }
 
+- (NSString *)targetFilePath
+{
+    NSString *path = nil;
+    CDVFilesystemURL *sourceURL = [CDVFilesystemURL fileSystemURLWithString:self.target];
+    if (sourceURL && sourceURL.fileSystemName != nil) {
+        // This requires talking to the current CDVFile plugin
+        NSObject<CDVFileSystem> *fs = [self.filePlugin filesystemForURL:sourceURL];
+        path = [fs filesystemPathForURL:sourceURL];
+    } else {
+        // Extract the path part out of a file: URL.
+        path = [self.target hasPrefix:@"/"] ? [self.target copy] : [(NSURL *)[NSURL URLWithString:self.target] path];
+    }
+    return path;
+}
+
 - (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response
 {
     NSError* __autoreleasing error = nil;
@@ -642,20 +657,11 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
     }
     if ((self.direction == CDV_TRANSFER_DOWNLOAD) && (self.responseCode >= 200) && (self.responseCode < 300)) {
         // Download response is okay; begin streaming output to file
-        NSString *filePath = nil;
-        CDVFilesystemURL *sourceURL = [CDVFilesystemURL fileSystemURLWithString:self.target];
-        if (sourceURL && sourceURL.fileSystemName != nil) {
-            // This requires talking to the current CDVFile plugin
-            NSObject<CDVFileSystem> *fs = [self.filePlugin filesystemForURL:sourceURL];
-            filePath = [fs filesystemPathForURL:sourceURL];
-        } else {
-            // Extract the path part out of a file: URL.
-            NSString* filePath = [self.target hasPrefix:@"/"] ? [self.target copy] : [(NSURL *)[NSURL URLWithString:self.target] path];
-            if (filePath == nil) {
-                // We couldn't find the asset.  Send the appropriate error.
-                [self cancelTransferWithError:connection errorMessage:[NSString stringWithFormat:@"Could not create target file"]];
-                return;
-            }
+        NSString *filePath = [self targetFilePath];
+        if (filePath == nil) {
+            // We couldn't find the asset.  Send the appropriate error.
+            [self cancelTransferWithError:connection errorMessage:[NSString stringWithFormat:@"Could not create target file"]];
+            return;
         }
 
         NSString* parentPath = [filePath stringByDeletingLastPathComponent];


[09/11] git commit: CB-6460: Update license headers

Posted by ia...@apache.org.
CB-6460: Update license headers


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/9b85ae12
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/9b85ae12
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/9b85ae12

Branch: refs/heads/master
Commit: 9b85ae122aa722d059cafd2719cb2e32f250259a
Parents: f2e56a2
Author: Ian Clelland <ic...@chromium.org>
Authored: Wed Apr 16 16:17:53 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Wed Apr 16 16:17:53 2014 -0400

----------------------------------------------------------------------
 plugin.xml | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/9b85ae12/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 842081a..552e588 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -1,4 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
 <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
     id="org.apache.cordova.file-transfer"