mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: settings: add extra validation
This commit is contained in:
1 parent
08ef44fa36
commit
50b105d5d1
1 file changed
+2
@@ -390,9 +390,11 @@ function set(s: Setting, key: string, value: any) {
|
||||
if (value) {
|
||||
if (['json', 'yaml', 'markdown', 'textarea'].includes(s.type)) {
|
||||
if (!Types.Content[1](value)) throw new ValidationError(key);
|
||||
return Types.Content[0](value);
|
||||
}
|
||||
if (s.type === 'text') {
|
||||
if (!Types.ShortString[1](value)) throw new ValidationError(key);
|
||||
return Types.ShortString[0](value);
|
||||
}
|
||||
}
|
||||
if (s.subType === 'yaml') {
|
||||
|
||||
Reference in new issue
Block a user