tus / tusd

Reference server implementation in Go of tus: the open protocol for resumable file uploads
https://tus.github.io/tusd
MIT License
2.93k stars 465 forks source link

handler: Fix error with RUFH upload ending too soon #1098

Closed Acconut closed 3 months ago

Acconut commented 3 months ago

Currently, if a RUFH PATCH requests gets interrupted, the error is swallowed by the bodyReader. This is not a problem for tus uploads, but leads to issues with RUFH uploads because a successful RUFH PATCH request with Upload-Complete: ?1 will set the upload length. If an interrupted PATCH is thus interpreted as successful, it will cause the upload length to be set to the offset at which the upload was interrupted and thus preventing the upload from being resumed.

This PR fixes this problem by not swallowing the error, making the handler aware of the interruption.