mirror of
https://github.com/fluxcd/flux2.git
synced 2025-11-02 02:35:49 +08:00
Normalize paths to forward slashes
Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
@ -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))
|
||||
|
||||
Reference in New Issue
Block a user