The source project of this merge request has been removed.
fix error when uploading image: java.net.ProtocolException: expected 2471 bytes but received 2519
Hi, when I upload images on my Samsung S10e, it causes an error sometimes
java.net.ProtocolException: expected 2471 bytes but received 2519
It seems the image would be changed while uploading, it might better create a copy, and upload the copy to solve it.
Reference: https://github.com/tuskyapp/Tusky/pull/1164
Logs:
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: java.net.ProtocolException: expected 2471 bytes but received 2519
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at com.android.okhttp.internal.http.Http1xStream$FixedLengthSink.write(Http1xStream.java:494)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at com.android.okhttp.okio.RealBufferedSink.flush(RealBufferedSink.java:221)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at com.android.okhttp.okio.RealBufferedSink$1.flush(RealBufferedSink.java:204)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at net.gotev.uploadservice.http.impl.HurlBodyWriter.flush(HurlBodyWriter.java:32)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at net.gotev.uploadservice.http.BodyWriter.writeStream(BodyWriter.java:52)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at net.gotev.uploadservice.MultipartUploadTask.writeFiles(MultipartUploadTask.java:143)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at net.gotev.uploadservice.MultipartUploadTask.onBodyReady(MultipartUploadTask.java:66)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at net.gotev.uploadservice.http.impl.HurlStackConnection.getResponse(HurlStackConnection.java:154)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at net.gotev.uploadservice.HttpUploadTask.upload(HttpUploadTask.java:72)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at net.gotev.uploadservice.UploadTask.run(UploadTask.java:155)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2019-06-14 16:10:45.624 30527-30527/fr.gouv.etalab.mastodon W/System.err: at java.lang.Thread.run(Thread.java:764)
Edited by lenchan139