Skip to content

Commit

Permalink
filestore: Do not error out on unexpected EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
Acconut committed May 15, 2019
1 parent 6de723e commit 0dd8efd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions filestore/filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 0dd8efd

Please sign in to comment.