Skip to content

Commit ecec57e

Browse files
cubercslvmcj
authored andcommitted
fix(printing API): Allow printing in any language
Since the UI allows selecting any available language or plain text, the API should also keep consistent behavior. Signed-off-by: cubercsl <[email protected]>
1 parent 28234a8 commit ecec57e

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

webapp/src/Controller/API/PrintController.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,10 @@ public function printAsTeam(
8383
->createQueryBuilder()
8484
->from(Language::class, "l")
8585
->select("l.langid")
86-
->andWhere("l.allowSubmit = 1")
8786
->andWhere("l.name = :name")
8887
->setParameter("name", $print->language)
8988
->getQuery()
9089
->getOneOrNullResult(AbstractQuery::HYDRATE_SINGLE_SCALAR);
91-
if ($langid === null) {
92-
throw new BadRequestHttpException("Programming language not found.");
93-
}
9490
}
9591

9692
$decodedFile = base64_decode($print->fileContents, true);

webapp/src/Service/DOMJudgeService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ public function printFile(
766766
$replaces = [
767767
'[file]' => escapeshellarg($filename),
768768
'[original]' => escapeshellarg($origname),
769-
'[language]' => escapeshellarg($language),
769+
'[language]' => escapeshellarg($language ?? ''),
770770
'[username]' => escapeshellarg($username),
771771
'[teamname]' => escapeshellarg($teamname ?? ''),
772772
'[teamid]' => escapeshellarg($teamid ?? ''),

0 commit comments

Comments
 (0)