mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 10:27:45 +00:00 
			
		
		
		
	Change last chunk size to fix a protocol exception when sending files
This commit is contained in:
		
							parent
							
								
									1baeebe5ee
								
							
						
					
					
						commit
						10e44627e1
					
				| @ -86,7 +86,8 @@ public class ChunkFromFileRequestBody extends FileRequestBody { | ||||
| 
 | ||||
|                 readCount = mChannel.read(mBuffer); | ||||
| 
 | ||||
|                 sink.getBuffer().write(mBuffer.array(), 0, readCount); | ||||
|                 int bytesToWriteInBuffer = (int) Math.min(readCount, mFile.length() - mTransferred); | ||||
|                 sink.getBuffer().write(mBuffer.array(), 0, bytesToWriteInBuffer); | ||||
| 
 | ||||
|                 sink.flush(); | ||||
| 
 | ||||
| @ -102,14 +103,12 @@ public class ChunkFromFileRequestBody extends FileRequestBody { | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             Timber.v("Chunk with size " + mChunkSize + " written in request body"); | ||||
| 
 | ||||
|         } catch (Exception exception) { | ||||
|             Timber.e(exception); | ||||
|             Timber.e(exception, "Transferred " + mTransferred + " bytes from a total of " + mFile.length()); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public void setOffset(long offset) { | ||||
|         this.mOffset = offset; | ||||
|     } | ||||
| } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user