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

fs: fix the defaults overriding the actual config

Nick Craig-Wood91558ce6aaca
diff --git a/fs/configmap.go b/fs/configmap.go
index 4155f830d..6f5ba5d52 100644
--- a/fs/configmap.go
+++ b/fs/configmap.go
@@ -64,7 +64,7 @@ type regInfoValues struct {
// the default values
func (r *regInfoValues) Get(key string) (value string, ok bool) {
opt := r.options.Get(key)
- if opt != nil && (r.useDefault || opt.Value != nil) {
+ if opt != nil && (r.useDefault || !opt.IsDefault()) {
return opt.String(), true
}
return "", false
diff --git a/fs/registry.go b/fs/registry.go
index 2c46194cb..d0799331f 100644
--- a/fs/registry.go
+++ b/fs/registry.go
@@ -244,6 +244,18 @@ func (o *Option) GetValue() interface{} {
return val
}
+// IsDefault returns true if the value is the default value
+func (o *Option) IsDefault() bool {
+ if o.Value == nil {
+ return true
+ }
+ Default := o.Default
+ if Default == nil {
+ Default = ""
+ }
+ return reflect.DeepEqual(o.Value, Default)
+}
+
// String turns Option into a string
func (o *Option) String() string {
v := o.GetValue()