Skip to content

Commit

Permalink
Handle mulwikisource in wscontest
Browse files Browse the repository at this point in the history
Update dependency to use the new wikisource/api release that handles mulwikiosurce, and normalise mulwikisource URLs before saving to database.

Bug: #T345325
  • Loading branch information
Parthiv-M authored Sep 20, 2023
1 parent 5b77ad2 commit 67f9ceb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/Controller/ContestsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ public function save(
}

$indexPageUrls = array_map( 'urldecode', Str::explode( $request->request->get( 'index_pages' ) ) );
$indexPageResult = $indexPageRepository->saveUrls( $indexPageUrls );
// normalise mulwikisource URLs before saving to database
$normalisedIndexPageUrls = array_map( static function ( $url ) {
return str_replace( "https://mul.", "https://", $url );
}, $indexPageUrls );
$indexPageResult = $indexPageRepository->saveUrls( $normalisedIndexPageUrls );
foreach ( $indexPageResult['warnings'] as $warning ) {
$this->addFlash( 'warning', $warning );
}
Expand All @@ -223,7 +227,7 @@ public function save(
$request->request->get( 'end_date' ),
$admins,
Str::explode( $request->request->get( 'excluded_users' ) ),
$indexPageUrls
$normalisedIndexPageUrls
);

// Reset scores, to ensure they'll be re-calculated.
Expand Down

0 comments on commit 67f9ceb

Please sign in to comment.