diff --git a/config/i18n.go b/config/i18n.go index a08ca3ca..c50047f9 100644 --- a/config/i18n.go +++ b/config/i18n.go @@ -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, diff --git a/models/classpath_resource.go b/models/classpath_resource.go index 4d7d96c2..2fab9737 100644 --- a/models/classpath_resource.go +++ b/models/classpath_resource.go @@ -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,