Skip to content

Commit 7859dc6

Browse files
committed
Be lenient as we can reasonably assume this is a ZIP file
1 parent 5a9c75e commit 7859dc6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

webapp/src/Service/ExternalContestSourceService.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,13 +1445,18 @@ protected function importSubmission(Event $event, EventData $data): void
14451445
'message' => 'No source files in event',
14461446
]);
14471447
$submissionDownloadSucceeded = false;
1448-
} elseif (($data->files[0]->mime ?? null) !== 'application/zip') {
1448+
} elseif ($data->files[0]->mime !== null && $data->files[0]->mime !== 'application/zip') {
14491449
$this->addOrUpdateWarning($event, $data->id, ExternalSourceWarning::TYPE_SUBMISSION_ERROR, [
14501450
'message' => 'Non-ZIP source files in event',
14511451
]);
14521452
$submissionDownloadSucceeded = false;
14531453
} else {
14541454
$zipUrl = $data->files[0]->href;
1455+
if (!isset($data['files'][0]['mime'])) {
1456+
$this->addOrUpdateWarning($event, $data->id, ExternalSourceWarning::TYPE_SUBMISSION_ERROR, [
1457+
'message' => 'MIME type not set, should be "application/zip"',
1458+
]);
1459+
}
14551460
if (preg_match('/^https?:\/\//', $zipUrl) === 0) {
14561461
// Relative URL, prepend the base URL.
14571462
$zipUrl = ($this->basePath ?? '') . $zipUrl;

0 commit comments

Comments
 (0)