mirror of
https://github.com/containers/podman.git
synced 2025-06-23 10:38:20 +08:00
Allow colons in windows file paths
the `podman save` command was failing on windows due to the use of a colon between the drive letter and first directory. the check was intended for Linux and not windows. Fixes #15247 [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
@ -151,15 +151,6 @@ func parseEnvOrLabelFile(envOrLabel map[string]string, filename, configType stri
|
||||
return scanner.Err()
|
||||
}
|
||||
|
||||
// ValidateFileName returns an error if filename contains ":"
|
||||
// as it is currently not supported
|
||||
func ValidateFileName(filename string) error {
|
||||
if strings.Contains(filename, ":") {
|
||||
return fmt.Errorf("invalid filename (should not contain ':') %q", filename)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ValidURL checks a string urlStr is a url or not
|
||||
func ValidURL(urlStr string) error {
|
||||
url, err := url.ParseRequestURI(urlStr)
|
||||
|
18
cmd/podman/parse/parse.go
Normal file
18
cmd/podman/parse/parse.go
Normal file
@ -0,0 +1,18 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package parse
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ValidateFileName returns an error if filename contains ":"
|
||||
// as it is currently not supported
|
||||
func ValidateFileName(filename string) error {
|
||||
if strings.Contains(filename, ":") {
|
||||
return fmt.Errorf("invalid filename (should not contain ':') %q", filename)
|
||||
}
|
||||
return nil
|
||||
}
|
5
cmd/podman/parse/parse_windows.go
Normal file
5
cmd/podman/parse/parse_windows.go
Normal file
@ -0,0 +1,5 @@
|
||||
package parse
|
||||
|
||||
func ValidateFileName(filename string) error {
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user