hydro-dev / Hydro

Hydro - Next generation high performance online-judge platform - 新一代高效强大的信息学在线测评系统 (a.k.a. vj5)
https://hydro.js.org/
GNU Affero General Public License v3.0
3.93k stars 301 forks source link

codeforces 域,作业题目:Cannot read property '1' of null #246

Closed lxlonlyn closed 2 years ago

lxlonlyn commented 2 years ago

codeforces 域是按照官方文档上 vjudge 插件整的。

我在 codeforces 域上创建了一个作业,但在作业页面点击题目时,某些题目会出错,显示如下界面:

image

在 pm2 log 中显示这样的错误:

3|hydrooj  | 2021-11-09T19:40:21: [E]  server  TypeError: Cannot read property '1' of null
3|hydrooj  | 2021-11-09T19:40:21:         at /usr/local/share/.config/yarn/global/node_modules/hydrooj/src/handler/problem.ts:329:63
3|hydrooj  | 2021-11-09T19:40:21:         at String.replace (<anonymous>)
3|hydrooj  | 2021-11-09T19:40:21:         at ProblemDetailHandler.get (/usr/local/share/.config/yarn/global/node_modules/hydrooj/src/handler/problem.ts:327:22)
3|hydrooj  | 2021-11-09T19:40:21:         at ProblemDetailHandler.validate (/usr/local/share/.config/yarn/global/node_modules/hydrooj/src/service/server.ts:220:39)
3|hydrooj  | 2021-11-09T19:40:21:         at handle (/usr/local/share/.config/yarn/global/node_modules/hydrooj/src/service/server.ts:715:32)
3|hydrooj  | 2021-11-09T19:40:21:         at runMicrotasks (<anonymous>)
3|hydrooj  | 2021-11-09T19:40:21:         at processTicksAndRejections (internal/process/task_queues.js:95:5)
3|hydrooj  | 2021-11-09T19:40:21:         at /usr/local/share/.config/yarn/global/node_modules/koa-static-cache/index.js:53:36
3|hydrooj  | 2021-11-09T19:40:21:         at /usr/local/share/.config/yarn/global/node_modules/koa-static-cache/index.js:53:36
3|hydrooj  | 2021-11-09T19:40:21:         at compressMiddleware (/usr/local/share/.config/yarn/global/node_modules/koa-compress/lib/index.js:52:5)

以下信息可能有所帮助:

出现这样错误的题目全都含有图片,而且这些题目在题库中浏览时可以正常显示。

我先尝试删除了图片,然后在作业页面的题目就能正常显示了。

但之后我把图片链接原样粘回原处时,题目中的图片无法正常显示(即使不在作业中),显示错误 Not allowed to load local resource: file://xxx.png/

后来我把图片的链接 file::xxx.png 改为 题目编号/file/xxx.png 后,在所有地方浏览都能正常显示。

想问一下这种错误如何避免?谢谢

undefined-moe commented 2 years ago

可否提供对应题目自动导入时的题面文本

undefined-moe commented 2 years ago

请测试3.1.27是否可以解决该问题

lxlonlyn commented 2 years ago

问题解决了,非常感谢。