diff --git a/webapp/src/DataTransferObject/Shadowing/SubmissionFile.php b/webapp/src/DataTransferObject/Shadowing/SubmissionFile.php index fe3848acfb..79310190bd 100644 --- a/webapp/src/DataTransferObject/Shadowing/SubmissionFile.php +++ b/webapp/src/DataTransferObject/Shadowing/SubmissionFile.php @@ -7,5 +7,6 @@ class SubmissionFile public function __construct( public readonly string $href, public readonly ?string $mime, + public readonly ?string $filename, ) {} } diff --git a/webapp/src/Service/ExternalContestSourceService.php b/webapp/src/Service/ExternalContestSourceService.php index d6bf05c4df..bc53ca6aec 100644 --- a/webapp/src/Service/ExternalContestSourceService.php +++ b/webapp/src/Service/ExternalContestSourceService.php @@ -200,7 +200,7 @@ public function getApiVersion(): ?string throw new LogicException('The contest source is not valid'); } - return $this->cachedApiInfoData->version; + return $this->cachedApiInfoData?->version; } public function getApiVersionUrl(): ?string @@ -209,7 +209,7 @@ public function getApiVersionUrl(): ?string throw new LogicException('The contest source is not valid'); } - return $this->cachedApiInfoData->versionUrl; + return $this->cachedApiInfoData?->versionUrl; } public function getApiProviderName(): ?string @@ -218,7 +218,7 @@ public function getApiProviderName(): ?string throw new LogicException('The contest source is not valid'); } - return $this->cachedApiInfoData->provider?->name ?? $this->cachedApiInfoData->name; + return $this->cachedApiInfoData?->provider?->name ?? $this->cachedApiInfoData?->name; } public function getApiProviderVersion(): ?string @@ -227,7 +227,7 @@ public function getApiProviderVersion(): ?string throw new LogicException('The contest source is not valid'); } - return $this->cachedApiInfoData->provider?->version ?? $this->cachedApiInfoData->domjudge?->version; + return $this->cachedApiInfoData?->provider?->version ?? $this->cachedApiInfoData?->domjudge?->version; } public function getApiProviderBuildDate(): ?string @@ -236,7 +236,7 @@ public function getApiProviderBuildDate(): ?string throw new LogicException('The contest source is not valid'); } - return $this->cachedApiInfoData->provider?->buildDate; + return $this->cachedApiInfoData?->provider?->buildDate; } public function getLoadingError(): string @@ -1435,6 +1435,14 @@ protected function importSubmission(Event $event, EventData $data): void $zipUrl = ($this->basePath ?? '') . $zipUrl; } + if ($this->source->getType() === ExternalContestSource::TYPE_CONTEST_PACKAGE && $data->files[0]->filename) { + $zipUrl = $this->source->getSource() . '/submissions/' . $data->id . '/' . $data->files[0]->filename; + if (!file_exists($zipUrl)) { + // Common case: submissions are in submissions/.zip + $zipUrl = $this->source->getSource() . '/submissions/' . $data->id . '.zip'; + } + } + $tmpdir = $this->dj->getDomjudgeTmpDir(); // Check if we have a local file.