Skip to content

Commit

Permalink
fix: dump tmp file into screen dump dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexej Disterhoft (DPDHL IT Services) committed Feb 23, 2024
1 parent f7adb49 commit 2e3a5d2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion internal/view/browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,19 @@ func editAndCreateFromFile(app *App, filePath string) *tcell.EventKey {
return nil
}

return createFromFile(app, filePath)
content, err := os.ReadFile(filePath)
if err != nil {
app.Flash().Errf("Failed to create resource from file %s", err)
return nil
}

dumpedFile, err := saveYAML(app.Config.K9s.ContextScreenDumpDir(), "create", string(content))
if err != nil {
app.Flash().Err(err)
return nil
}

return createFromFile(app, dumpedFile)
}

func isFileEmpty(filePath string) (bool, error) {
Expand Down

0 comments on commit 2e3a5d2

Please sign in to comment.