Fix debug bundle panic on Windows (#14399)

* Fix debug bundle panic on Windows

* Add changelog entry
This commit is contained in:
Dave May 2022-06-09 18:57:45 -04:00 committed by GitHub
parent 1bd49383cd
commit 0f42131350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

3
changelog/14399.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
debug: Fix panic when capturing debug bundle on Windows
```

View File

@ -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