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: fix identification of directories for Bitrix Site Manager - #2716

Nick Craig-Wood08c4854e0001
diff --git a/backend/webdav/api/types.go b/backend/webdav/api/types.go
index 991bcc827..f9cf2d349 100644
--- a/backend/webdav/api/types.go
+++ b/backend/webdav/api/types.go
@@ -66,12 +66,13 @@ type Response struct {
// Note that status collects all the status values for which we just
// check the first is OK.
type Prop struct {
- Status []string `xml:"DAV: status"`
- Name string `xml:"DAV: prop>displayname,omitempty"`
- Type *xml.Name `xml:"DAV: prop>resourcetype>collection,omitempty"`
- Size int64 `xml:"DAV: prop>getcontentlength,omitempty"`
- Modified Time `xml:"DAV: prop>getlastmodified,omitempty"`
- Checksums []string `xml:"prop>checksums>checksum,omitempty"`
+ Status []string `xml:"DAV: status"`
+ Name string `xml:"DAV: prop>displayname,omitempty"`
+ Type *xml.Name `xml:"DAV: prop>resourcetype>collection,omitempty"`
+ IsCollection *int `xml:"DAV: prop>iscollection,omitempty"` // this is a Microsoft extension see #2716
+ Size int64 `xml:"DAV: prop>getcontentlength,omitempty"`
+ Modified Time `xml:"DAV: prop>getlastmodified,omitempty"`
+ Checksums []string `xml:"prop>checksums>checksum,omitempty"`
}
// Parse a status of the form "HTTP/1.1 200 OK" or "HTTP/1.1 200"
diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go
index 5cb257501..3c2db188d 100644
--- a/backend/webdav/webdav.go
+++ b/backend/webdav/webdav.go
@@ -172,6 +172,11 @@ func itemIsDir(item *api.Response) bool {
}
fs.Debugf(nil, "Unknown resource type %q/%q on %q", t.Space, t.Local, item.Props.Name)
}
+ // the iscollection prop is a Microsoft extension, but if present it is a reliable indicator
+ // if the above check failed - see #2716
+ if t := item.Props.IsCollection; t != nil {
+ return *t != 0
+ }
return false
}