Skip to content

Commit da4f8f5

Browse files
When we shadow, trust the filenames and file sizes.
1 parent dc910da commit da4f8f5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

webapp/src/Service/SubmissionService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ public function submitSolution(
567567
$entryPoint = null;
568568
}
569569

570-
if (!empty($entryPoint) && !preg_match(self::FILENAME_REGEX, $entryPoint)) {
570+
if ($source !== 'shadowing' && !empty($entryPoint) && !preg_match(self::FILENAME_REGEX, $entryPoint)) {
571571
$message = sprintf("Entry point '%s' contains illegal characters.", $entryPoint);
572572
if ($forceImportInvalid) {
573573
$importError = $message;
@@ -608,7 +608,7 @@ public function submitSolution(
608608
$message = sprintf("File '%s' not found (or not readable).", $file->getRealPath());
609609
return null;
610610
}
611-
if (!preg_match(self::FILENAME_REGEX, $file->getClientOriginalName())) {
611+
if ($source !== 'shadowing' && !preg_match(self::FILENAME_REGEX, $file->getClientOriginalName())) {
612612
$message = sprintf("Illegal filename '%s'.", $file->getClientOriginalName());
613613
if ($forceImportInvalid) {
614614
$importError = $message;
@@ -645,7 +645,7 @@ public function submitSolution(
645645
}
646646
}
647647

648-
if ($totalSize > $sourceSize * 1024) {
648+
if ($source !== 'shadowing' && $totalSize > $sourceSize * 1024) {
649649
$message = sprintf("Submission file(s) are larger than %d kB.", $sourceSize);
650650
if ($forceImportInvalid) {
651651
$importError = $message;

0 commit comments

Comments
 (0)