diff --git a/filestore/filestore.go b/filestore/filestore.go index 4944dbd..bef3ec1 100644 --- a/filestore/filestore.go +++ b/filestore/filestore.go @@ -85,6 +85,15 @@ func (store FileStore) WriteChunk(id string, offset int64, src io.Reader) (int64 defer file.Close() n, err := io.Copy(file, src) + + // If the HTTP PATCH request gets interrupted in the middle (e.g. because + // the user wants to pause the upload), Go's net/http returns an io.ErrUnexpectedEOF. + // However, for FileStore it's not important whether the stream has ended + // on purpose or accidentally. + if err == io.ErrUnexpectedEOF { + err = nil + } + return n, err }