Skip to content

Commit f4e0004

Browse files
nickygerritsenvmcj
authored andcommitted
Drop double / between base path and relative URL's.
1 parent a25d24b commit f4e0004

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

webapp/src/Service/ExternalContestSourceService.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,10 @@ protected function importSubmission(Event $event, EventData $data): void
14481448
$zipUrl = $data->files[0]->href;
14491449
if (preg_match('/^https?:\/\//', $zipUrl) === 0) {
14501450
// Relative URL, prepend the base URL.
1451+
// If both the base path ends with a / and the zip URL starts with one, drop one of them
1452+
if (str_ends_with($this->basePath, '/') && str_starts_with($zipUrl, '/')) {
1453+
$zipUrl = substr($zipUrl, 1);
1454+
}
14511455
$zipUrl = ($this->basePath ?? '') . $zipUrl;
14521456
}
14531457

0 commit comments

Comments
 (0)