Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

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

Paul5e3bf50b2e0b
diff --git a/backend/webdav/chunking.go b/backend/webdav/chunking.go
index 471678acc..4cea79838 100644
--- a/backend/webdav/chunking.go
+++ b/backend/webdav/chunking.go
@@ -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
}