Skip to content

Commit 0884032

Browse files
bugfix write-to flag only runs filepath.Clean when the output file is not "" or -
1 parent 3b39d4a commit 0884032

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/clusterctl/cmd/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ func printYamlOutput(printer client.YamlPrinter, outputFile string) error {
3838
if err != nil {
3939
return err
4040
}
41-
outputFile = filepath.Clean(strings.TrimSpace(outputFile))
4241
yaml = append(yaml, '\n')
42+
outputFile = strings.TrimSpace(outputFile)
4343
if outputFile == "" || outputFile == "-" {
4444
if _, err := os.Stdout.Write(yaml); err != nil {
4545
return errors.Wrap(err, "failed to write yaml to Stdout")
4646
}
4747
return nil
4848
}
49-
49+
outputFile = filepath.Clean(outputFile)
5050
if err := os.WriteFile(outputFile, yaml, 0600); err != nil {
5151
return errors.Wrap(err, "failed to write to destination file")
5252
}

0 commit comments

Comments
 (0)