From 7d2ca09d1b0c4696cf04023a80dc8f3dfa33bbb9 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch
Date: Mon, 22 Apr 2019 10:09:08 +0200 Subject: sklad: show the context when deleting containers Do not try to show the deleted container. --- cmd/sklad/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/sklad/main.go b/cmd/sklad/main.go index 83b9213..8a7e939 100644 --- a/cmd/sklad/main.go +++ b/cmd/sklad/main.go @@ -107,6 +107,12 @@ func handleContainerPost(r *http.Request) error { } func handleContainer(w http.ResponseWriter, r *http.Request) { + // When deleting, do not try to show the deleted entry but the context. + shownId := r.FormValue("context") + if shownId == "" { + shownId = r.FormValue("id") + } + var err error if r.Method == http.MethodPost { err = handleContainerPost(r) @@ -128,7 +134,7 @@ func handleContainer(w http.ResponseWriter, r *http.Request) { var container *Container children := indexChildren[""] - if c, ok := indexContainer[ContainerId(r.FormValue("id"))]; ok { + if c, ok := indexContainer[ContainerId(shownId)]; ok { children = c.Children() container = c } -- cgit v1.2.3-70-g09d2