owncloud: add config owncloud_exclude_mounts which allows to exclude mounted folders when listing remote resources

This commit is contained in:
Thomas Müller 2024-03-12 11:55:36 +01:00 committed by Nick Craig-Wood
parent ca903b9872
commit c7bfadd10a

View file

@ -154,6 +154,11 @@ Set to 0 to disable chunked uploading.
Help: "Exclude ownCloud shares",
Advanced: true,
Default: false,
}, {
Name: "owncloud_exclude_mounts",
Help: "Exclude ownCloud mounted storages",
Advanced: true,
Default: false,
}},
})
}
@ -171,6 +176,7 @@ type Options struct {
PacerMinSleep fs.Duration `config:"pacer_min_sleep"`
ChunkSize fs.SizeSuffix `config:"nextcloud_chunk_size"`
ExcludeShares bool `config:"owncloud_exclude_shares"`
ExcludeMounts bool `config:"owncloud_exclude_mounts"`
}
// Fs represents a remote webdav
@ -805,10 +811,17 @@ func (f *Fs) listAll(ctx context.Context, dir string, directoriesOnly bool, file
}
}
if f.opt.ExcludeShares {
// https: //owncloud.dev/apis/http/webdav/#supported-webdav-properties
if strings.Contains(item.Props.Permissions, "S") {
continue
}
}
if f.opt.ExcludeMounts {
// https: //owncloud.dev/apis/http/webdav/#supported-webdav-properties
if strings.Contains(item.Props.Permissions, "M") {
continue
}
}
// item.Name = restoreReservedChars(item.Name)
if fn(remote, isDir, &item.Props) {
found = true