path: dest paths inside container should always be treated as *nix type

Destination path inside containers should be always validated  as
*nix absolute path. So its recommended to use path.IsAbs() instead of
filepath.IsAbs().

[NO TEST NEEDED]

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
This commit is contained in:
flouthoc 2021-08-16 09:40:31 +05:30
parent a608c93598
commit e278dcf7ef
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ package parse
import (
"os"
"path"
"path/filepath"
"strings"
@ -155,7 +156,7 @@ func ValidateVolumeCtrDir(ctrDir string) error {
if ctrDir == "" {
return errors.New("container directory cannot be empty")
}
if !filepath.IsAbs(ctrDir) {
if !path.IsAbs(ctrDir) {
return errors.Errorf("invalid container path %q, must be an absolute path", ctrDir)
}
return nil