Unverified Commit 5f5d4fd4 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #63439 from liggitt/from-file

Automatic merge from submit-queue (batch tested with PRs 63315, 63383, 63318, 63439). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. compute configmap/secret key correctly cross-platform fixes #61710 ```release-note `kubectl create [secret | configmap] --from-file` now works on Windows with fully-qualified paths ```
parents 238fda9e 17e62d91
......@@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"path"
"path/filepath"
"strings"
"time"
......@@ -60,7 +61,7 @@ func ParseFileSource(source string) (keyName, filePath string, err error) {
numSeparators := strings.Count(source, "=")
switch {
case numSeparators == 0:
return path.Base(source), source, nil
return path.Base(filepath.ToSlash(source)), source, nil
case numSeparators == 1 && strings.HasPrefix(source, "="):
return "", "", fmt.Errorf("key name for file path %v missing.", strings.TrimPrefix(source, "="))
case numSeparators == 1 && strings.HasSuffix(source, "="):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment