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

mount: On Windows don't add -o uid/gid=-1 if user supplies -o uid/gid.

Nick Craig-Wood0ee16b51c4de
diff --git a/cmd/cmount/mount.go b/cmd/cmount/mount.go
index ebda4dcd9..50c755985 100644
--- a/cmd/cmount/mount.go
+++ b/cmd/cmount/mount.go
@@ -12,6 +12,7 @@ import (
"fmt"
"os"
"runtime"
+ "strings"
"time"
"github.com/billziss-gh/cgofuse/fuse"
@@ -58,11 +59,26 @@ func mountOptions(VFS *vfs.VFS, device string, mountpoint string, opt *mountlib.
}
}
+ // determine if ExtraOptions already has an opt in
+ hasOption := func(optionName string) bool {
+ optionName += "="
+ for _, option := range opt.ExtraOptions {
+ if strings.HasPrefix(option, optionName) {
+ return true
+ }
+ }
+ return false
+ }
+
// Windows options
if runtime.GOOS == "windows" {
// These cause WinFsp to mean the current user
- options = append(options, "-o", "uid=-1")
- options = append(options, "-o", "gid=-1")
+ if !hasOption("uid") {
+ options = append(options, "-o", "uid=-1")
+ }
+ if !hasOption("gid") {
+ options = append(options, "-o", "gid=-1")
+ }
options = append(options, "--FileSystemName=rclone")
}