"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
webdav: Don't accept redirects when reading metadata #2350
Nick Craig-Wood1550f7086524
diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.goindex ba4e75cab..d5e1250c3 100644--- a/backend/webdav/webdav.go+++ b/backend/webdav/webdav.go@@ -182,6 +182,7 @@ func (f *Fs) readMetaDataForPath(path string) (info *api.Prop, err error) {ExtraHeaders: map[string]string{"Depth": "1",},+ NoRedirect: true,}var result api.Multistatusvar resp *http.Response@@ -191,7 +192,13 @@ func (f *Fs) readMetaDataForPath(path string) (info *api.Prop, err error) {})if apiErr, ok := err.(*api.Error); ok {// does not exist- if apiErr.StatusCode == http.StatusNotFound {+ switch apiErr.StatusCode {+ case http.StatusNotFound:+ return nil, fs.ErrorObjectNotFound+ case http.StatusMovedPermanently, http.StatusFound, http.StatusSeeOther:+ // Some sort of redirect - go doesn't deal with these properly (it resets+ // the method to GET). However we can assume that if it was redirected the+ // object was not found.return nil, fs.ErrorObjectNotFound}}