api: Parse error message with the title to check

When the custom error message contains {{PAGENAME}} or other title based
variables, there are currently parsed as
"Badtitle/dummy_title_for_API_calls_set_in_api.php"
The same custom message is shown correctly on index.php

Bug: T340923
Change-Id: I4c1dc6660976de54ff6ba8f8f7a5768371e61e80
This commit is contained in:
Umherirrender 2023-07-02 10:29:12 +02:00
parent f87949916c
commit 8584bb40bd

View file

@ -72,7 +72,7 @@ class ApiQueryTitleBlacklist extends ApiBase {
$res->addValue( 'titleblacklist', 'result', 'blacklisted' );
// there aren't any messages for create(talk|page), using edit for those instead
$message = $blacklisted->getErrorMessage( $action !== 'create' ? $action : 'edit' );
$res->addValue( 'titleblacklist', 'reason', $this->msg( $message, $result )->text() );
$res->addValue( 'titleblacklist', 'reason', $this->msg( $message, $result )->page( $title )->text() );
$res->addValue( 'titleblacklist', 'message', $message );
$res->addValue( 'titleblacklist', 'line', htmlspecialchars( $blacklisted->getRaw() ) );
} else {