dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Add CollationFa"
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiCSPReport.php
diff --git
a/includes/api/ApiCSPReport.php
b/includes/api/ApiCSPReport.php
index
5a0edfc
..
4139019
100644
(file)
--- a/
includes/api/ApiCSPReport.php
+++ b/
includes/api/ApiCSPReport.php
@@
-137,8
+137,11
@@
class ApiCSPReport extends ApiBase {
}
$status = FormatJson::parse( $postBody, FormatJson::FORCE_ASSOC );
if ( !$status->isGood() ) {
}
$status = FormatJson::parse( $postBody, FormatJson::FORCE_ASSOC );
if ( !$status->isGood() ) {
- list( $code, ) = $this->getErrorFromStatus( $status );
- $this->error( $code, __METHOD__ );
+ $msg = $status->getErrors()[0]['message'];
+ if ( $msg instanceof Message ) {
+ $msg = $msg->getKey();
+ }
+ $this->error( $msg, __METHOD__ );
}
$report = $status->getValue();
}
$report = $status->getValue();
@@
-176,7
+179,7
@@
class ApiCSPReport extends ApiBase {
*
* @param $code String error code
* @param $method String method that made error
*
* @param $code String error code
* @param $method String method that made error
- * @throws UsageException Always
+ * @throws
Api
UsageException Always
*/
private function error( $code, $method ) {
$this->log->info( 'Error reading CSP report: ' . $code, [
*/
private function error( $code, $method ) {
$this->log->info( 'Error reading CSP report: ' . $code, [
@@
-184,7
+187,9
@@
class ApiCSPReport extends ApiBase {
'user-agent' => $this->getRequest()->getHeader( 'user-agent' )
] );
// 500 so it shows up in browser's developer console.
'user-agent' => $this->getRequest()->getHeader( 'user-agent' )
] );
// 500 so it shows up in browser's developer console.
- $this->dieUsage( "Error processing CSP report: $code", 'cspreport-' . $code, 500 );
+ $this->dieWithError(
+ [ 'apierror-csp-report', wfEscapeWikiText( $code ) ], 'cspreport-' . $code, [], 500
+ );
}
public function getAllowedParams() {
}
public function getAllowedParams() {