"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
fs: fix confusing "didn't find section in config file" error
Nick Craig-Wood5316acd046d2
diff --git a/backend/googlephotos/googlephotos_test.go b/backend/googlephotos/googlephotos_test.goindex cd1e0943f..0eeb99bce 100644--- a/backend/googlephotos/googlephotos_test.go+++ b/backend/googlephotos/googlephotos_test.go@@ -2,6 +2,7 @@ package googlephotosimport ("context"+ "errors""fmt""io""net/http"@@ -35,7 +36,7 @@ func TestIntegration(t *testing.T) {*fstest.RemoteName = "TestGooglePhotos:"}f, err := fs.NewFs(ctx, *fstest.RemoteName)- if err == fs.ErrorNotFoundInConfigFile {+ if errors.Is(err, fs.ErrorNotFoundInConfigFile) {t.Skipf("Couldn't create google photos backend - skipping tests: %v", err)}require.NoError(t, err)diff --git a/fs/cache/cache_test.go b/fs/cache/cache_test.goindex d9d54fa2e..0448f0244 100644--- a/fs/cache/cache_test.go+++ b/fs/cache/cache_test.go@@ -131,7 +131,7 @@ func TestPutErr(t *testing.T) {assert.Equal(t, 1, Entries())fNew, err := GetFn(context.Background(), "mock:/", create)- require.Equal(t, fs.ErrorNotFoundInConfigFile, err)+ require.True(t, errors.Is(err, fs.ErrorNotFoundInConfigFile))require.Equal(t, f, fNew)assert.Equal(t, 1, Entries())@@ -141,7 +141,7 @@ func TestPutErr(t *testing.T) {PutErr("mock:/file.txt", f, fs.ErrorNotFoundInConfigFile)fNew, err = GetFn(context.Background(), "mock:/file.txt", create)- require.Equal(t, fs.ErrorNotFoundInConfigFile, err)+ require.True(t, errors.Is(err, fs.ErrorNotFoundInConfigFile))require.Equal(t, f, fNew)assert.Equal(t, 1, Entries())diff --git a/fs/newfs.go b/fs/newfs.goindex d59a505a6..f4f7dd346 100644--- a/fs/newfs.go+++ b/fs/newfs.go@@ -6,6 +6,7 @@ import ("context""crypto/md5""encoding/base64"+ "fmt""os""path/filepath""strings"@@ -104,7 +105,7 @@ func ParseRemote(path string) (fsInfo *RegInfo, configName, fsPath string, connem := ConfigMap("", nil, configName, parsed.Config)fsName, ok = m.Get("type")if !ok {- return nil, "", "", nil, ErrorNotFoundInConfigFile+ return nil, "", "", nil, fmt.Errorf("%w (%q)", ErrorNotFoundInConfigFile, configName)}}} else {diff --git a/fs/rc/rcserver/rcserver_test.go b/fs/rc/rcserver/rcserver_test.goindex 29738b614..f79a926cf 100644--- a/fs/rc/rcserver/rcserver_test.go+++ b/fs/rc/rcserver/rcserver_test.go@@ -358,7 +358,7 @@ func TestRemoteServing(t *testing.T) {URL: "[notfoundremote:]/",Status: http.StatusInternalServerError,Expected: `{- "error": "failed to make Fs: didn't find section in config file",+ "error": "failed to make Fs: didn't find section in config file (\"notfoundremote\")","input": null,"path": "/","status": 500diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.goindex 2e840cd0c..6024177c6 100644--- a/fstest/fstests/fstests.go+++ b/fstest/fstests/fstests.go@@ -459,7 +459,7 @@ func Run(t *testing.T, opt *Opt) {subRemoteName, subRemoteLeaf, err = fstest.RandomRemoteName(remoteName)require.NoError(t, err)f, err = fs.NewFs(context.Background(), subRemoteName)- if err == fs.ErrorNotFoundInConfigFile {+ if errors.Is(err, fs.ErrorNotFoundInConfigFile) {t.Logf("Didn't find %q in config file - skipping tests", remoteName)return}