Skip to content
Open
5 changes: 4 additions & 1 deletion plugins/admin/controller/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions plugins/admin/controller/detail.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 != "" {
Expand Down