filestore: Do not error out on unexpected EOF
@@ -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
}
