Skip to content

Commit 3fb0003

Browse files
elderingvmcj
authored andcommitted
Warn when uploading testdata with DOS/Windows newlines.
Fixes #1961. (cherry picked from commit 0f93b1f)
1 parent 5a3360d commit 3fb0003

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

webapp/src/Service/ImportProblemService.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,13 @@ public function importZippedProblem(
430430
}
431431
}
432432

433+
if (str_contains($testInput, "\r")) {
434+
$messages['warning'][] = "Testcase file '$baseFileName.in' contains Windows newlines.";
435+
}
436+
if (str_contains($testOutput, "\r")) {
437+
$messages['warning'][] = "Testcase file '$baseFileName.ans' contains Windows newlines.";
438+
}
439+
433440
$md5in = md5($testInput);
434441
$md5out = md5($testOutput);
435442

0 commit comments

Comments
 (0)