Fix not to assign a value to toBind

Signed-off-by: Seiya Miyata <odradek38@gmail.com>
This commit is contained in:
Seiya Miyata 2023-05-18 17:40:00 +09:00
parent 935df5a59f
commit cac48f1ec6
No known key found for this signature in database
GPG Key ID: BDCFA42000D5AB40
1 changed files with 1 additions and 2 deletions

View File

@ -360,13 +360,12 @@ func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*con
toBind := bind
if parsed.Type == string(mounttypes.TypeBind) {
if hostPart, targetPath, ok := strings.Cut(bind, ":"); ok {
if hostPart, _, ok := strings.Cut(bind, ":"); ok {
if strings.HasPrefix(hostPart, "."+string(filepath.Separator)) || hostPart == "." {
if absHostPart, err := filepath.Abs(hostPart); err == nil {
hostPart = absHostPart
}
}
toBind = hostPart + ":" + targetPath
}
}