Skip to content
Snippets Groups Projects

fix the issue

2 unresolved threads
1 file
+ 9
4
Compare changes
  • Side-by-side
  • Inline
@@ -114,17 +114,22 @@ class ReportingEndpoint extends ControllerBase {
* The Request object.
*/
private function storeReportUriData(ReportingEndpointInterface $reporting_endpoint, array $report, Request $request) {
// Provide default values for the 'csp-report' data if the key is missing.
$cspReport = isset($report['csp-report']) ? $report['csp-report'] : [
Please register or sign in to reply
'document-uri' => 'unknown',
// You can add other default values here if needed.
];
// Convert data to format expected by Reporting API.
$report = [
$reportData = [
Please register or sign in to reply
'age' => 0,
'body' => $report['csp-report'],
'body' => $cspReport,
'type' => 'csp-violation',
'url' => $report['csp-report']['document-uri'],
'url' => $cspReport['document-uri'],
'user_agent' => $request->headers->get('User-Agent'),
];
$this->storeReportToData($reporting_endpoint, [$report]);
$this->storeReportToData($reporting_endpoint, [$reportData]);
}
/**
Loading