webdav: nextcloud: fix segment violation in low-level retry

Fix https://github.com/rclone/rclone/issues/7168

Co-authored-by: ncw <nick@craig-wood.com>
Co-authored-by: Paul <devnoname120@gmail.com>
This commit is contained in:
Paul 2023-07-31 19:24:42 +02:00 committed by Nick Craig-Wood
parent 982f76b4df
commit 5e3bf50b2e
1 changed files with 2 additions and 2 deletions

View File

@ -121,7 +121,7 @@ func (o *Object) uploadChunks(ctx context.Context, in0 io.Reader, size int64, pa
getBody := func() (io.ReadCloser, error) {
// RepeatableReader{} plays well with accounting so rewinding doesn't make the progress buggy
if _, err := in.Seek(0, io.SeekStart); err == nil {
if _, err := in.Seek(0, io.SeekStart); err != nil {
return nil, err
}
@ -203,7 +203,7 @@ func (o *Object) purgeUploadedChunks(ctx context.Context, uploadDir string) erro
resp, err := o.fs.srv.CallXML(ctx, &opts, nil, nil)
// directory doesn't exist, no need to purge
if resp.StatusCode == http.StatusNotFound {
if resp != nil && resp.StatusCode == http.StatusNotFound {
return false, nil
}