diff --git a/plugins/admin/controller/common.go b/plugins/admin/controller/common.go index 7aab75989..dbbaeef79 100644 --- a/plugins/admin/controller/common.go +++ b/plugins/admin/controller/common.go @@ -234,7 +234,10 @@ func isInfoUrl(s string) bool { sub := reg.FindStringSubmatch(s) return len(sub) > 2 && !strings.Contains(sub[2], "/") } - +func isDetailUrl(s string, p string) bool { + reg, _ := regexp.Compile("(.*?)info/" + p + "/detail") + return reg.MatchString(s) +} func isNewUrl(s string, p string) bool { reg, _ := regexp.Compile("(.*?)info/" + p + "/new") return reg.MatchString(s) diff --git a/plugins/admin/controller/detail.go b/plugins/admin/controller/detail.go index ab10ebd86..04819c2a6 100644 --- a/plugins/admin/controller/detail.go +++ b/plugins/admin/controller/detail.go @@ -27,6 +27,7 @@ func (h *Handler) ShowDetail(ctx *context.Context) { info = panel.GetInfo() formModel = newPanel.GetForm() fieldList = make(types.FieldList, 0) + referer = ctx.Referer() ) if len(detail.FieldList) == 0 { @@ -71,6 +72,10 @@ func (h *Handler) ShowDetail(ctx *context.Context) { editUrl = user.GetCheckPermissionByUrlMethod(editUrl, h.route("show_edit").Method()) deleteUrl = user.GetCheckPermissionByUrlMethod(deleteUrl, h.route("delete").Method()) + if referer != "" && !isInfoUrl(referer) && !isDetailUrl(referer, ctx.Query(constant.PrefixKey)) { + infoUrl = referer + } + deleteJs := "" if deleteUrl != "" {