mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 22:22:21 +08:00
serve docker: fix incorrect conversion between integer types
This commit is contained in:
parent
7261f47bd2
commit
4c488e7517
|
@ -2,6 +2,7 @@ package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/rclone/rclone/cmd/mountlib"
|
"github.com/rclone/rclone/cmd/mountlib"
|
||||||
|
@ -272,10 +273,22 @@ func getVFSOption(vfsOpt *vfscommon.Options, opt rc.Params, key string) (ok bool
|
||||||
err = getFVarP(&vfsOpt.Umask, opt, key)
|
err = getFVarP(&vfsOpt.Umask, opt, key)
|
||||||
case "uid":
|
case "uid":
|
||||||
intVal, err = opt.GetInt64(key)
|
intVal, err = opt.GetInt64(key)
|
||||||
vfsOpt.UID = uint32(intVal)
|
if err == nil {
|
||||||
|
if intVal >= 0 && intVal <= math.MaxUint32 {
|
||||||
|
vfsOpt.UID = uint32(intVal)
|
||||||
|
} else {
|
||||||
|
err = fmt.Errorf("key %q (%v) overflows uint32", key, intVal)
|
||||||
|
}
|
||||||
|
}
|
||||||
case "gid":
|
case "gid":
|
||||||
intVal, err = opt.GetInt64(key)
|
intVal, err = opt.GetInt64(key)
|
||||||
vfsOpt.GID = uint32(intVal)
|
if err == nil {
|
||||||
|
if intVal >= 0 && intVal <= math.MaxUint32 {
|
||||||
|
vfsOpt.UID = uint32(intVal)
|
||||||
|
} else {
|
||||||
|
err = fmt.Errorf("key %q (%v) overflows uint32", key, intVal)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// non-vfs options
|
// non-vfs options
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user