summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2022-08-24 09:28:39 -0500
committerMatthew Heon <mheon@redhat.com>2022-09-06 14:25:19 -0400
commit931ccdcaa585a48df11ffcab716cfb77e62ce4cd (patch)
treeaa633468936c8f87872a9a467f1ea59ea5bb851d
parent64fe541a62fe304ab47fd006e3d81db190059a1c (diff)
downloadpodman-931ccdcaa585a48df11ffcab716cfb77e62ce4cd.tar.gz
podman-931ccdcaa585a48df11ffcab716cfb77e62ce4cd.tar.bz2
podman-931ccdcaa585a48df11ffcab716cfb77e62ce4cd.zip
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>
-rw-r--r--cmd/podman/parse/net.go9
-rw-r--r--cmd/podman/parse/parse.go18
-rw-r--r--cmd/podman/parse/parse_windows.go5
3 files changed, 23 insertions, 9 deletions
diff --git a/cmd/podman/parse/net.go b/cmd/podman/parse/net.go
index 9228c7127..a5c7a0d95 100644
--- a/cmd/podman/parse/net.go
+++ b/cmd/podman/parse/net.go
@@ -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)
diff --git a/cmd/podman/parse/parse.go b/cmd/podman/parse/parse.go
new file mode 100644
index 000000000..47db066d3
--- /dev/null
+++ b/cmd/podman/parse/parse.go
@@ -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
+}
diff --git a/cmd/podman/parse/parse_windows.go b/cmd/podman/parse/parse_windows.go
new file mode 100644
index 000000000..794f4216d
--- /dev/null
+++ b/cmd/podman/parse/parse_windows.go
@@ -0,0 +1,5 @@
+package parse
+
+func ValidateFileName(filename string) error {
+ return nil
+}