github.com/moby/docker@v26.1.3+incompatible/pkg/archive/path.go (about) 1 package archive 2 3 // CheckSystemDriveAndRemoveDriveLetter verifies that a path, if it includes a drive letter, 4 // is the system drive. 5 // On Linux: this is a no-op. 6 // On Windows: this does the following> 7 // CheckSystemDriveAndRemoveDriveLetter verifies and manipulates a Windows path. 8 // This is used, for example, when validating a user provided path in docker cp. 9 // If a drive letter is supplied, it must be the system drive. The drive letter 10 // is always removed. Also, it translates it to OS semantics (IOW / to \). We 11 // need the path in this syntax so that it can ultimately be concatenated with 12 // a Windows long-path which doesn't support drive-letters. Examples: 13 // C: --> Fail 14 // C:\ --> \ 15 // a --> a 16 // /a --> \a 17 // d:\ --> Fail 18 func CheckSystemDriveAndRemoveDriveLetter(path string) (string, error) { 19 return checkSystemDriveAndRemoveDriveLetter(path) 20 }