filestore: Do not error out on unexpected EOF
This commit is contained in:
parent
6de723ec8b
commit
0dd8efd606
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue