cli: fix incorrect file path for master secret during upgrades when using workspace flag (#2249)

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2023-08-16 15:38:40 +02:00 committed by GitHub
parent dfe7c9884b
commit c2bb884a04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 54 additions and 52 deletions

View file

@ -22,7 +22,7 @@ import (
"path/filepath"
)
// PathPrefixer is used to prefix paths with the configured workspace.
// PathPrefixer is used to prefix paths with the configured workspace for printing.
type PathPrefixer struct {
workspace string
}
@ -32,7 +32,9 @@ func New(workspace string) PathPrefixer {
return PathPrefixer{workspace: workspace}
}
// PrefixPath prefixes the given path with the configured workspace.
func (p PathPrefixer) PrefixPath(path string) string {
// PrefixPrintablePath prefixes the given path with the configured workspace for printing.
// This function MUST not be used when accessing files.
// This function SHOULD be used when printing paths to the user.
func (p PathPrefixer) PrefixPrintablePath(path string) string {
return filepath.Clean(filepath.Join(p.workspace, path))
}