tus-android-client icon indicating copy to clipboard operation
tus-android-client copied to clipboard

How to clear the chunk cache or solve this problem?

Open cryinrain69 opened this issue 2 years ago • 1 comments

If I select a new file to upload, everything works fine. But then I select that file again (I've uploaded it before) and it fails to upload, crashes when calling uploader.finish() Logs:

io.tus.java.client.ProtocolException: unexpected status code (400 or 500) while uploading chunk
17:55:09.578 System.err en....atech.vovnews W at io.tus.java.client.TusUploader.finishConnection(TusUploader.java:343)
17:55:09.579 System.err en....atech.vovnews W at io.tus.java.client.TusUploader.finish(TusUploader.java:321)
17:55:09.579 System.err en....atech.vovnews W at io.tus.java.client.TusUploader.finish(TusUploader.java:306)

I checked and found uploader.uploadChunk() = -1, before do do { ...} while(uploader.uploadChunk() > -1)

I thought clearing chunk cache might be a solution but I couldn't find that method.

cryinrain69 avatar Jul 18 '23 11:07 cryinrain69

I thought clearing chunk cache might be a solution but I couldn't find that method.

There is no direct method for doing this, but you can try to clear the SharedPreferences that are passed to TusPreferencesURLStore: https://github.com/tus/tus-android-client/blob/6b10cdf56aaea5f3b39dd8951e59d585dc23cac6/tus-android-client/src/main/java/io/tus/android/client/TusPreferencesURLStore.java#L14

But then I select that file again (I've uploaded it before) and it fails to upload, crashes when calling uploader.finish()

Please provide all answers to the question template and provide your uploading code: https://github.com/tus/tus-android-client/blob/main/.github/ISSUE_TEMPLATE/question.md Otherwise, it is hard for us to help you.

Acconut avatar Jul 19 '23 06:07 Acconut