Skip to content

Commit ca39490

Browse files
vmcjnickygerritsen
authored andcommitted
Be lenient as we can reasonably assume this is a ZIP file
1 parent 72ee993 commit ca39490

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
@@ -1438,13 +1438,18 @@ protected function importSubmission(Event $event, EventData $data): void
14381438
'message' => 'No source files in event',
14391439
]);
14401440
$submissionDownloadSucceeded = false;
1441-
} elseif (($data->files[0]->mime ?? null) !== 'application/zip') {
1441+
} elseif ($data->files[0]->mime !== null && $data->files[0]->mime !== 'application/zip') {
14421442
$this->addOrUpdateWarning($event, $data->id, ExternalSourceWarning::TYPE_SUBMISSION_ERROR, [
14431443
'message' => 'Non-ZIP source files in event',
14441444
]);
14451445
$submissionDownloadSucceeded = false;
14461446
} else {
14471447
$zipUrl = $data->files[0]->href;
1448+
if (!isset($data['files'][0]['mime'])) {
1449+
$this->addOrUpdateWarning($event, $data->id, ExternalSourceWarning::TYPE_SUBMISSION_ERROR, [
1450+
'message' => 'MIME type not set, should be "application/zip"',
1451+
]);
1452+
}
14481453
if (preg_match('/^https?:\/\//', $zipUrl) === 0) {
14491454
// Relative URL, prepend the base URL.
14501455
$zipUrl = ($this->basePath ?? '') . $zipUrl;

0 commit comments

Comments
 (0)