You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
目前库中,检查 Event Name 不符合规则后会直接 panic,逻辑隐蔽,处理粗暴,很容易被坑。
建议改成返回 error
相关代码见 util.go:
// goodName check event name is valid.funcgoodName(namestring, isRegbool) string {
name=strings.TrimSpace(name)
ifname=="" {
panic("event: the event name cannot be empty")
}
// on add listenerifisReg {
ifname==AllNode||name==Wildcard {
returnWildcard
}
ifstrings.HasPrefix(name, AllNode) {
returnname
}
}
if!goodNameReg.MatchString(name) {
panic(`event: name is invalid, must match regex:`+goodNameReg.String())
}
returnname
}
The text was updated successfully, but these errors were encountered:
目前库中,检查 Event Name 不符合规则后会直接 panic,逻辑隐蔽,处理粗暴,很容易被坑。
建议改成返回 error
相关代码见 util.go:
The text was updated successfully, but these errors were encountered: