mirror of
https://github.com/rclone/rclone.git
synced 2024-11-23 08:54:10 +01:00
2c50f26c36
This commit
3567a47258
fs: make ConfigString properly reverse suffixed file systems
made fs.ConfigString() return the full config of the backend. Because
mount was using this to make a volume name it started to make volume
names with illegal characters in which couldn't be mounted by macOS.
This fixes the problem by making a separate fs.ConfigStringFull() and
using that where appropriate and leaving the original
fs.ConfigString() function untouched.
Fixes #7063
See: https://forum.rclone.org/t/1-63-beta-fails-to-mount-on-macos-with-on-the-fly-crypt-remote/39090
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package fs_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/rclone/rclone/fs"
|
|
"github.com/rclone/rclone/fstest/mockfs"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestNewFs(t *testing.T) {
|
|
ctx := context.Background()
|
|
|
|
// Register mockfs temporarily
|
|
oldRegistry := fs.Registry
|
|
mockfs.Register()
|
|
defer func() {
|
|
fs.Registry = oldRegistry
|
|
}()
|
|
|
|
f1, err := fs.NewFs(ctx, ":mockfs:/tmp")
|
|
require.NoError(t, err)
|
|
assert.Equal(t, ":mockfs", f1.Name())
|
|
assert.Equal(t, "/tmp", f1.Root())
|
|
|
|
assert.Equal(t, ":mockfs:/tmp", fs.ConfigString(f1))
|
|
|
|
f2, err := fs.NewFs(ctx, ":mockfs,potato:/tmp")
|
|
require.NoError(t, err)
|
|
assert.Equal(t, ":mockfs{S_NHG}", f2.Name())
|
|
assert.Equal(t, "/tmp", f2.Root())
|
|
|
|
assert.Equal(t, ":mockfs{S_NHG}:/tmp", fs.ConfigString(f2))
|
|
assert.Equal(t, ":mockfs,potato='true':/tmp", fs.ConfigStringFull(f2))
|
|
|
|
f3, err := fs.NewFs(ctx, ":mockfs,potato='true':/tmp")
|
|
require.NoError(t, err)
|
|
assert.Equal(t, ":mockfs{S_NHG}", f3.Name())
|
|
assert.Equal(t, "/tmp", f3.Root())
|
|
|
|
assert.Equal(t, ":mockfs{S_NHG}:/tmp", fs.ConfigString(f3))
|
|
assert.Equal(t, ":mockfs,potato='true':/tmp", fs.ConfigStringFull(f3))
|
|
}
|