feat: localize absolute paths

This commit is contained in:
Claudio Busse
2023-11-26 12:22:15 +01:00
parent 779f153071
commit 7b1eaf1e4f
6 changed files with 69 additions and 22 deletions

View File

@@ -112,9 +112,13 @@ func hasRef(repoURL string) bool {
return repoSpec.Ref != ""
}
// cleanFilePath returns file cleaned, where file is a relative path to root on fSys
func cleanFilePath(fSys filesys.FileSystem, root filesys.ConfirmedDir, file string) string {
abs := root.Join(file)
// cleanedRelativePath returns a cleaned relative path of file to root on fSys
func cleanedRelativePath(fSys filesys.FileSystem, root filesys.ConfirmedDir, file string) string {
abs := file
if !filepath.IsAbs(file) {
abs = root.Join(file)
}
dir, f, err := fSys.CleanedAbs(abs)
if err != nil {
log.Fatalf("cannot clean validated file path %q: %s", abs, err)