mirror of https://github.com/k3s-io/k3s
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 ```pull/8/head
commit
5f5d4fd450
|
@ -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, "="):
|
||||
|
|
Loading…
Reference in New Issue