Skip to content

Commit 61bea8e

Browse files
committed
fix: verify lang on submission
1 parent 9715b07 commit 61bea8e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

vj4/handler/contest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ async def post(self, *, ctype: str, tid: objectid.ObjectId, pid: document.conver
506506
# TODO(tc-imba): only constant.record.FILE_TYPE_TAR and constant.record.FILE_TYPE_ZIP is supported now
507507
code_type = self.file_type or constant.record.FILE_TYPE_TEXT
508508
show_detail = 'show_case_detail' in pdoc and pdoc['show_case_detail']
509+
if lang not in (pdoc.get('languages') or []):
510+
raise error.InvalidArgumentError('lang')
509511
rid = await record.add(self.domain_id, pdoc['doc_id'], constant.record.TYPE_SUBMISSION,
510512
self.user['_id'], lang, code, tid=tdoc['doc_id'], hidden=False,
511513
code_type=code_type, show_detail=show_detail)

0 commit comments

Comments
 (0)