diff --git a/changelog/14399.txt b/changelog/14399.txt new file mode 100644 index 000000000..5d5c6b179 --- /dev/null +++ b/changelog/14399.txt @@ -0,0 +1,3 @@ +```release-note:bug +debug: Fix panic when capturing debug bundle on Windows +``` \ No newline at end of file diff --git a/command/debug.go b/command/debug.go index 0dd0fbf13..631ec9b41 100644 --- a/command/debug.go +++ b/command/debug.go @@ -349,7 +349,7 @@ func (c *DebugCommand) generateIndex() error { dir, file := filepath.Split(relPath) if len(dir) != 0 { - dir = strings.TrimSuffix(dir, "/") + dir = filepath.Clean(dir) filesArr := outputLayout[dir].(map[string]interface{})["files"] outputLayout[dir].(map[string]interface{})["files"] = append(filesArr.([]string), file) } else { @@ -448,7 +448,7 @@ func (c *DebugCommand) preflight(rawArgs []string) (string, error) { } // Strip trailing slash before proceeding - c.flagOutput = strings.TrimSuffix(c.flagOutput, "/") + c.flagOutput = filepath.Clean(c.flagOutput) // If compression is enabled, trim the extension so that the files are // written to a directory even if compression somehow fails. We ensure the