Skip to content

Commit

Permalink
volume: move validating volume dest from client to server.
Browse files Browse the repository at this point in the history
[NO TESTS NEEDED]

Signed-off-by: flouthoc <[email protected]>
  • Loading branch information
flouthoc committed Aug 16, 2021
1 parent a38d753 commit f985699
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 4 additions & 0 deletions libpod/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,10 @@ func WithNamedVolumes(volumes []*ContainerNamedVolume) CtrCreateOption {
return errors.Wrapf(err, "error processing options for named volume %q mounted at %q", vol.Name, vol.Dest)
}

if err = parse.ValidateVolumeCtrDir(vol.Dest); err != nil {
return errors.Wrapf(err, "error validating destination path for named volume %q mounted at %q", vol.Name, vol.Dest)
}

ctr.config.NamedVolumes = append(ctr.config.NamedVolumes, &ContainerNamedVolume{
Name: vol.Name,
Dest: vol.Dest,
Expand Down
3 changes: 0 additions & 3 deletions pkg/specgen/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ func GenVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*Na
return nil, nil, nil, errors.New("host directory cannot be empty")
}
}
if err := parse.ValidateVolumeCtrDir(dest); err != nil {
return nil, nil, nil, err
}

cleanDest := filepath.Clean(dest)

Expand Down

0 comments on commit f985699

Please sign in to comment.