Skip to content

Commit 0bc1729

Browse files
committed
core: bug fix
1 parent 751288e commit 0bc1729

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Hydro 用户群:1085853538
111111
<details>
112112
<summary><h2>更新日志(点击展开)</h2></summary>
113113

114-
## Hydro 4.17.2 / UI 4.55.2
114+
## Hydro 4.17.3 / UI 4.55.2
115115

116116
- core: 限制显示名长度
117117
- core: 支持调整代码长度限制
@@ -124,6 +124,7 @@ Hydro 用户群:1085853538
124124
- core: 支持 StorageModel.copy 和 StorageModel.exists
125125
- core: 弃用 ProblemModel.list
126126
- core: 添加 user/import/parse 和 user/import/create 钩子
127+
- core: 优化题目列表查询性能
127128

128129
## Hydro 4.16.0 / UI 4.54.3
129130

packages/hydrooj/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hydrooj",
3-
"version": "4.17.2",
3+
"version": "4.17.3",
44
"bin": "bin/hydrooj.js",
55
"main": "src/plugin-api",
66
"module": "src/plugin-api",

packages/hydrooj/src/handler/home.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,13 @@ function set(s: Setting, key: string, value: any) {
368368
if (Number.isNaN(+value)) throw new ValidationError(key);
369369
return +value;
370370
}
371-
if (['json', 'yaml', 'markdown', 'textarea'].includes(s.type)) {
372-
if (!Types.Content[1](value)) throw new ValidationError(key);
373-
}
374-
if (s.type === 'text') {
375-
if (!Types.ShortString[1](value)) throw new ValidationError(key);
371+
if (value) {
372+
if (['json', 'yaml', 'markdown', 'textarea'].includes(s.type)) {
373+
if (!Types.Content[1](value)) throw new ValidationError(key);
374+
}
375+
if (s.type === 'text') {
376+
if (!Types.ShortString[1](value)) throw new ValidationError(key);
377+
}
376378
}
377379
if (s.subType === 'yaml') {
378380
try {

packages/hydrooj/src/handler/homework.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class HomeworkDetailHandler extends Handler {
128128
Object.assign(this.response.body, { pdict, psdict, rdict });
129129
}
130130

131-
async postAttend(domainId: string) {
131+
async postAttend({ domainId }) {
132132
this.checkPerm(PERM.PERM_ATTEND_HOMEWORK);
133133
if (contest.isDone(this.tdoc)) throw new HomeworkNotLiveError(this.tdoc.docId);
134134
await contest.attend(domainId, this.tdoc.docId, this.user._id);

0 commit comments

Comments
 (0)