Browse Source

Correct android download byte count #25

Ben Hsieh 8 years ago
parent
commit
d4bbce78aa

+ 1
- 1
src/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobDefaultResp.java View File

63
         public long read(Buffer sink, long byteCount) throws IOException {
63
         public long read(Buffer sink, long byteCount) throws IOException {
64
 
64
 
65
             long read =  mOriginalSource.read(sink, byteCount);
65
             long read =  mOriginalSource.read(sink, byteCount);
66
-            bytesRead += read;
66
+            bytesRead += read > 0 ? read : 0;
67
             WritableMap args = Arguments.createMap();
67
             WritableMap args = Arguments.createMap();
68
             args.putString("taskId", mTaskId);
68
             args.putString("taskId", mTaskId);
69
             args.putString("written", String.valueOf(bytesRead));
69
             args.putString("written", String.valueOf(bytesRead));