check resource exists when bind classpath

This commit is contained in:
UlricQin 2021-08-24 10:35:00 +08:00
parent 12e3b3a490
commit f21909adb8
2 changed files with 10 additions and 0 deletions

View File

@ -59,6 +59,7 @@ var (
"Regexp %s matched, but cannot get substring()": "主正则 %s 匹配成功,但无法匹配到子串",
"TagKey or TagValue contains illegal characters[:,/=\r\n\t]": "标签KEY或者标签值包含非法字符串[:,/=\r\n\t]",
"Resource cannot delete in preset classpath": "预置分组不能删除资源",
"No such resource %s": "不存在该资源(%s)",
}
langDict = map[string]map[string]string{
"zh": dict,

View File

@ -56,6 +56,15 @@ func ClasspathResourceAdd(classpathId int64, resIdent string) error {
return nil
}
res, err := ResourceGet("ident=?", resIdent)
if err != nil {
return err
}
if res == nil {
return _e("No such resource %s", resIdent)
}
obj := ClasspathResource{
ClasspathId: classpathId,
ResIdent: resIdent,