Fixed error reporting (current web page url, JS file name sanitization)

- Added tests on master branch
- Added support for js/*.js files
- Added support for slashes and dots in file paths
- Added back support for 'url' (the current webpage)

All js files where reported as 'index.php' now they are reported as their real name

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2019-05-01 20:31:40 +02:00
parent a4714b168d
commit 07389d12aa
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
2 changed files with 7 additions and 2 deletions

View File

@ -224,7 +224,7 @@ var ErrorReport = {
'server': PMA_commonParams.get('server'),
'ajax_request': true,
'exception': exception,
'current_url': window.location.href,
'url': window.location.href,
'exception_type': 'js'
};
if (AJAX.scriptHandler._scripts.length > 0) {

View File

@ -99,6 +99,11 @@ class ErrorReport
$exception["uri"] = $uri;
$report["script_name"] = $scriptName;
unset($exception["url"]);
} else if (isset($_POST["url"])) {
list($uri, $scriptName) = $this->sanitizeUrl($_POST["url"]);
$exception["uri"] = $uri;
$report["script_name"] = $scriptName;
unset($_POST["url"]);
} else {
$report["script_name"] = null;
}
@ -175,7 +180,7 @@ class ErrorReport
}
// get script name
preg_match("<([a-zA-Z\-_\d]*\.php)$>", $components["path"], $matches);
preg_match("<([a-zA-Z\-_\d\.]*\.php|js\/[a-zA-Z\-_\d\/\.]*\.js)$>", $components["path"], $matches);
if (count($matches) < 2) {
$scriptName = 'index.php';
} else {