diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 2e76b9133..65314a554 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "3.14.12", + "version": "3.14.13", "bin": "bin/hydrooj.js", "main": "src/loader", "module": "src/loader", diff --git a/packages/hydrooj/src/lib/validator.ts b/packages/hydrooj/src/lib/validator.ts index a28f0fcd2..5829cf32c 100644 --- a/packages/hydrooj/src/lib/validator.ts +++ b/packages/hydrooj/src/lib/validator.ts @@ -59,8 +59,8 @@ export function validate(scheme: any, arg: any) { return _validate(scheme, arg, ''); } -export const isTitle = (s) => typeof s === 'string' && s.trim().length < 64; -export const checkTitle = (s) => { if (!(typeof s === 'string' && s.trim().length < 64)) throw new ValidationError('title'); else return s; }; +export const isTitle = (s) => typeof s === 'string' && s.trim().length && s.trim().length < 64; +export const checkTitle = (s) => { if (!(s?.trim()?.length && s.trim().length < 64)) throw new ValidationError('title'); else return s; }; export const isDomainId = (s) => RE_DOMAINID.test(s); export const checkDomainId = (s) => { if (!isDomainId(s)) throw new ValidationError('domainId'); else return s; }; export const isUid = (s) => RE_UID.test(s);