Skip to content

Commit 115fdd9

Browse files
willww64vvoland
andcommitted
Update cli/config/configfile/file.go
use filepath.EvalSymlink instead of check with filepath.IsAbs Co-authored-by: Paweł Gronowski <me@woland.xyz> Signed-off-by: Will Wang <willww64@gmail.com>
1 parent c90705a commit 115fdd9

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

cli/config/configfile/file.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,8 @@ func (configFile *ConfigFile) Save() (retErr error) {
169169

170170
// Handle situation where the configfile is a symlink
171171
cfgFile := configFile.Filename
172-
if f, err := os.Readlink(cfgFile); err == nil {
172+
if f, err := filepath.EvalSymlinks(cfgFile); err == nil {
173173
cfgFile = f
174-
// The target of a symlink can be a relative path, ensure the final path is absolute
175-
if !filepath.IsAbs(f) {
176-
cfgFile = filepath.Join(dir, f)
177-
}
178174
}
179175

180176
// Try copying the current config file (if any) ownership and permissions

0 commit comments

Comments
 (0)