mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 09:04:52 +01: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 (
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
"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)
|
||||
case "uid":
|
||||
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":
|
||||
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
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user