tus/tus-java-client

If file Size equals to payload size, the upload fails.

Closed this issue · 3 comments

If you upload a file of size equal to payload size, the upload fails.
Because it tries to make 1 extra attempt to upload the last chunk with 0 file length.

This seems a very generic issue, it shouldn't make a new attempt to upload the last chunk of size 0 byte.
while (uploader.uploadChunk() > 0)

Thank you for reporting this, we will investigate. However, it seems to be more related to tus-java-client than tus-android-client.

I am not able to reproduce an upload failure, even when adding uploader.setRequestPayloadSize((int) file.length()); to the example in https://github.com/tus/tus-java-client/blob/master/example/src/main/java/io/tus/java/example/Main.java. You are correct that tus-java-client sends an empty PATCH request in the end. Your tus server should support such empty requests however.

We plan to improve this in the next major version of tus-java-client where we will get rid of this upload loop at together. Thanks for letting us know.

See #78