Skip to content

Commit

Permalink
Extension filter checks full extension, including dot
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsNiklas committed Nov 18, 2023
1 parent 8d73e77 commit 88fa2e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions webapp/src/Service/SubmissionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,9 @@ public function submitSolution(
if ($source !== 'shadowing' && $language->getFilterCompilerFiles()) {
$matchesExtension = false;
foreach ($language->getExtensions() as $extension) {
$extensionLength = strlen($extension);
if (substr($file->getClientOriginalName(), -$extensionLength) === $extension) {
$extensionWithDot = '.' . ltrim($extension, '.');
$extensionLength = strlen($extensionWithDot);
if (substr($file->getClientOriginalName(), -$extensionLength) === $extensionWithDot) {
$matchesExtension = true;
break;
}
Expand Down

0 comments on commit 88fa2e6

Please sign in to comment.