From 9ab4ebb72e648156b2af60578de112022f856fb4 Mon Sep 17 00:00:00 2001 From: Ben Hsieh Date: Thu, 3 Aug 2017 09:37:08 +0800 Subject: [PATCH 1/6] bump to 0.10.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0d88ec178..a93dba81d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-fetch-blob", - "version": "0.10.7", + "version": "0.10.8", "description": "A module provides upload, download, and files access API. Supports file stream read/write for process large files.", "main": "index.js", "scripts": { From 1336555d79014a181ab79350434e016ea1bc8324 Mon Sep 17 00:00:00 2001 From: Ben Hsieh Date: Thu, 3 Aug 2017 09:42:16 +0800 Subject: [PATCH 2/6] Update PULL_REQUEST_TEMPLATE --- .github/PULL_REQUEST_TEMPLATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE b/.github/PULL_REQUEST_TEMPLATE index cef8ed2af..b03e3e8e3 100644 --- a/.github/PULL_REQUEST_TEMPLATE +++ b/.github/PULL_REQUEST_TEMPLATE @@ -1,5 +1,5 @@ Thank you for making a pull request ! Just a gentle reminder :) 1. If the PR is offering a feature please make the request to our "Feature Branch" 0.11.0 -2. Bug fix request to "Bug Fix Branch" 0.10.8 +2. Bug fix request to "Bug Fix Branch" 0.10.9 3. Correct README.md can directly to master From 2aea0b58e99581000d7336697e70b3bba7670a50 Mon Sep 17 00:00:00 2001 From: grylance Date: Wed, 9 Aug 2017 16:12:33 +0100 Subject: [PATCH 3/6] Fix path argument in iOS excludeFromBackupKey (#473) --- ios.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios.js b/ios.js index 566b424e2..340ef04cf 100644 --- a/ios.js +++ b/ios.js @@ -43,7 +43,7 @@ function openDocument(path:string, scheme:string) { * @param {string} url URL of the resource, only file URL is supported * @return {Promise} */ -function excludeFromBackupKey(url:string) { +function excludeFromBackupKey(path:string) { return RNFetchBlob.excludeFromBackupKey('file://' + path); } From 821eeb0f9db1736009ee791c14298ef72144a825 Mon Sep 17 00:00:00 2001 From: Kota Furusawa Date: Thu, 24 Aug 2017 10:02:20 +0800 Subject: [PATCH 4/6] Fix README (#501) remove extra space --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7680fab86..3c7d24a59 100644 --- a/README.md +++ b/README.md @@ -236,7 +236,7 @@ RNFetchBlob console.log('The file saved to ', res.path()) // Beware that when using a file path as Image source on Android, // you must prepend "file://"" before the file path - imageView = + imageView = }) ``` From d582c91410fe0ecfec624368dfc7e5e613c29520 Mon Sep 17 00:00:00 2001 From: Jan Karres Date: Sun, 22 Oct 2017 18:32:51 +0200 Subject: [PATCH 5/6] #555 Cancel download throw error bugfix (Android) --- index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.js b/index.js index bd67986fa..f66dbff04 100644 --- a/index.js +++ b/index.js @@ -229,7 +229,13 @@ function fetch(...args:any):Promise { } // from remote HTTP(S) + let promiseResolve; + let promiseReject; + let promise = new Promise((resolve, reject) => { + promiseResolve = resolve; + promiseReject = reject; + let nativeMethodName = Array.isArray(body) ? 'fetchBlobForm' : 'fetchBlob' // on progress event listener @@ -370,6 +376,7 @@ function fetch(...args:any):Promise { subscriptionUpload.remove() stateEvent.remove() RNFetchBlob.cancelRequest(taskId, fn) + promiseReject(new Error("canceled")) } promise.taskId = taskId From e655b88889475a78742ff8201ba8f95447575cd5 Mon Sep 17 00:00:00 2001 From: Jan Karres Date: Wed, 8 Nov 2017 12:11:16 +0100 Subject: [PATCH 6/6] Allow HTTP body for DELETE request --- android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java | 4 ++-- ios/RNFetchBlobReqBuilder.m | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java index 8a81a832e..990134bc1 100644 --- a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java +++ b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java @@ -239,7 +239,7 @@ else if (value.equalsIgnoreCase("utf8")) } } - if(method.equalsIgnoreCase("post") || method.equalsIgnoreCase("put") || method.equalsIgnoreCase("patch")) { + if(method.equalsIgnoreCase("post") || method.equalsIgnoreCase("put") || method.equalsIgnoreCase("patch") || method.equalsIgnoreCase("delete")) { String cType = getHeaderIgnoreCases(mheaders, "Content-Type").toLowerCase(); if(rawRequestBodyArray != null) { @@ -300,7 +300,7 @@ else if(cType.isEmpty()) { break; case WithoutBody: - if(method.equalsIgnoreCase("post") || method.equalsIgnoreCase("put") || method.equalsIgnoreCase("patch")) + if(method.equalsIgnoreCase("post") || method.equalsIgnoreCase("put") || method.equalsIgnoreCase("patch") || method.equalsIgnoreCase("delete")) { builder.method(method, RequestBody.create(null, new byte[0])); } diff --git a/ios/RNFetchBlobReqBuilder.m b/ios/RNFetchBlobReqBuilder.m index 15465a1ae..878b19e01 100644 --- a/ios/RNFetchBlobReqBuilder.m +++ b/ios/RNFetchBlobReqBuilder.m @@ -99,8 +99,8 @@ +(void) buildOctetRequest:(NSDictionary *)options dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSMutableData * blobData; long size = -1; - // if method is POST, PUT or PATCH, convert data string format - if([[method lowercaseString] isEqualToString:@"post"] || [[method lowercaseString] isEqualToString:@"put"] || [[method lowercaseString] isEqualToString:@"patch"]) { + // if method is POST, PUT, PATCH or DELETE, convert data string format + if([[method lowercaseString] isEqualToString:@"post"] || [[method lowercaseString] isEqualToString:@"put"] || [[method lowercaseString] isEqualToString:@"patch"] || [[method lowercaseString] isEqualToString:@"delete"]) { // generate octet-stream body if(body != nil) { __block NSString * cType = [[self class] getHeaderIgnoreCases:@"content-type" fromHeaders:mheaders]; @@ -117,7 +117,7 @@ +(void) buildOctetRequest:(NSDictionary *)options orgPath = [RNFetchBlobFS getPathOfAsset:orgPath]; if([orgPath hasPrefix:AL_PREFIX]) { - + [RNFetchBlobFS readFile:orgPath encoding:nil onComplete:^(NSData *content, NSString * err) { if(err != nil) { @@ -131,7 +131,7 @@ +(void) buildOctetRequest:(NSDictionary *)options onComplete(request, [content length]); } }]; - + return; } size = [[[NSFileManager defaultManager] attributesOfItemAtPath:orgPath error:nil] fileSize];