Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 4fe6a3e

Browse files
committed
Correct Android upload task #49 #25
1 parent 1538401 commit 4fe6a3e

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobDefaultResp.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ private class ProgressReportingSource implements Source {
6161

6262
@Override
6363
public long read(Buffer sink, long byteCount) throws IOException {
64-
bytesRead += byteCount;
64+
6565
long read = mOriginalSource.read(sink, byteCount);
66+
bytesRead += read;
6667
WritableMap args = Arguments.createMap();
6768
args.putString("taskId", mTaskId);
6869
args.putString("written", String.valueOf(bytesRead));

src/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public long read(Buffer sink, long byteCount) throws IOException {
6868
count++;
6969
byte [] bytes = new byte[(int) byteCount];
7070
long read = originalBody.byteStream().read(bytes, 0, (int) byteCount);
71+
bytesUploaded += read > 0 ? read : 0;
7172
if(read > 0) {
7273
bytesUploaded += read;
7374
ofStream.write(bytes, 0, (int) read);

test/test-0.6.3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const dirs = RNFetchBlob.fs.dirs
2727

2828
let prefix = ((Platform.OS === 'android') ? 'file://' : '')
2929

30-
false && describe('massive HTTP request', (report, done) => {
30+
describe('massive HTTP request', (report, done) => {
3131

3232
let promises = []
3333
let progress = []

0 commit comments

Comments
 (0)