mirror of
https://github.com/fluxcd/flux2.git
synced 2026-04-25 12:58:51 +00:00
Normalize paths to forward slashes
Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
parent
5a67f94380
commit
e0dd12505f
5 changed files with 12 additions and 8 deletions
|
|
@ -18,6 +18,7 @@ package flags
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
securejoin "github.com/cyphar/filepath-securejoin"
|
||||
|
|
@ -29,6 +30,10 @@ func (p *SafeRelativePath) String() string {
|
|||
return string(*p)
|
||||
}
|
||||
|
||||
func (p *SafeRelativePath) ToSlash() string {
|
||||
return filepath.ToSlash(p.String())
|
||||
}
|
||||
|
||||
func (p *SafeRelativePath) Set(str string) error {
|
||||
// The result of secure joining on a relative base dir is a flattened relative path.
|
||||
cleanP, err := securejoin.SecureJoin("./", strings.TrimSpace(str))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue