Fix directory path when viewing ScreenDump (#1777)
* Fix path when viewing ScreenDump * Log save should use `CurrentCluster` iso `CurrentContext` * Remove sanitizing of dir in ScreenDump dao * Switch `CurrentCluster` to `CurrentContext` for SD * Revert log saving to `CurrentContext` * Save tables to `CurrentContext` iso `CurrentCluster`mine
parent
56ab42db54
commit
d0f4fa5b90
|
|
@ -37,7 +37,7 @@ func (d *ScreenDump) List(ctx context.Context, _ string) ([]runtime.Object, erro
|
|||
return nil, errors.New("no screendump dir found in context")
|
||||
}
|
||||
|
||||
ff, err := os.ReadDir(SanitizeFilename(dir))
|
||||
ff, err := os.ReadDir(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/derailed/k9s/internal"
|
||||
"github.com/derailed/k9s/internal/client"
|
||||
"github.com/derailed/k9s/internal/config"
|
||||
"github.com/derailed/k9s/internal/dao"
|
||||
"github.com/derailed/k9s/internal/ui"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
|
@ -34,7 +35,7 @@ func NewScreenDump(gvr client.GVR) ResourceViewer {
|
|||
}
|
||||
|
||||
func (s *ScreenDump) dirContext(ctx context.Context) context.Context {
|
||||
dir := filepath.Join(s.App().Config.K9s.GetScreenDumpDir(), s.App().Config.K9s.CurrentCluster)
|
||||
dir := filepath.Join(s.App().Config.K9s.GetScreenDumpDir(), dao.SanitizeFilename(s.App().Config.K9s.CurrentContext))
|
||||
log.Debug().Msgf("SD-DIR %q", dir)
|
||||
config.EnsureFullPath(dir, config.DefaultDirMod)
|
||||
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ func (t *Table) BufferActive(state bool, k model.BufferKind) {
|
|||
}
|
||||
|
||||
func (t *Table) saveCmd(evt *tcell.EventKey) *tcell.EventKey {
|
||||
if path, err := saveTable(t.app.Config.K9s.GetScreenDumpDir(), t.app.Config.K9s.CurrentCluster, t.GVR().R(), t.Path, t.GetFilteredData()); err != nil {
|
||||
if path, err := saveTable(t.app.Config.K9s.GetScreenDumpDir(), t.app.Config.K9s.CurrentContext, t.GVR().R(), t.Path, t.GetFilteredData()); err != nil {
|
||||
t.app.Flash().Err(err)
|
||||
} else {
|
||||
t.app.Flash().Infof("File %s saved successfully!", path)
|
||||
|
|
|
|||
Loading…
Reference in New Issue