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

cmount: fix unicode issues with accented characters on macOS

Nick Craig-Wood92187a3b3332
diff --git a/cmd/cmount/mount.go b/cmd/cmount/mount.go
index de5691399..94f1084fd 100644
--- a/cmd/cmount/mount.go
+++ b/cmd/cmount/mount.go
@@ -12,6 +12,7 @@ import (
"fmt"
"os"
"runtime"
+ "strings"
"sync/atomic"
"time"
@@ -36,6 +37,19 @@ func init() {
mountlib.AddRc("cmount", mount)
}
+// Find the option string in the current options
+func findOption(name string, options []string) (found bool) {
+ for _, option := range options {
+ if option == "-o" {
+ continue
+ }
+ if strings.Contains(option, name) {
+ return true
+ }
+ }
+ return false
+}
+
// mountOptions configures the options from the command line flags
func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.Options) (options []string) {
// Options
@@ -105,6 +119,13 @@ func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.
for _, option := range opt.ExtraFlags {
options = append(options, option)
}
+ if runtime.GOOS == "darwin" {
+ if !findOption("modules=iconv", options) {
+ iconv := "modules=iconv,from_code=UTF-8,to_code=UTF-8-MAC"
+ options = append(options, "-o", iconv)
+ fs.Debugf(nil, "Adding \"-o %s\" for macOS", iconv)
+ }
+ }
return options
}