mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-15 04:57:56 +00:00
Replace improper usage of filepath.Join with path.Join
In JSON and kubernetes API object names we want to use slashes instead of the OS dependent file path separator.
This commit is contained in:
parent
f0513eeda0
commit
76b95b6c55
2 changed files with 5 additions and 5 deletions
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
package apihelper
|
package apihelper
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,6 +29,6 @@ type JsonPatch struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewJsonPatch returns a new JsonPatch object
|
// NewJsonPatch returns a new JsonPatch object
|
||||||
func NewJsonPatch(verb string, path string, key string, value string) JsonPatch {
|
func NewJsonPatch(verb string, jsonpath string, key string, value string) JsonPatch {
|
||||||
return JsonPatch{verb, filepath.Join(path, strings.ReplaceAll(key, "/", "~1")), value}
|
return JsonPatch{verb, path.Join(jsonpath, strings.ReplaceAll(key, "/", "~1")), value}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -500,7 +500,7 @@ func addNs(src string, nsToAdd string) string {
|
||||||
if strings.Contains(src, "/") {
|
if strings.Contains(src, "/") {
|
||||||
return src
|
return src
|
||||||
}
|
}
|
||||||
return filepath.Join(nsToAdd, src)
|
return path.Join(nsToAdd, src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// splitNs splits a name into its namespace and name parts
|
// splitNs splits a name into its namespace and name parts
|
||||||
|
|
Loading…
Add table
Reference in a new issue