interfaces: correct content-type match, it can have ;charset etc. suffix

PR: https://forum.opnsense.org/index.php?topic=5709.0
This commit is contained in:
Franco Fichtner 2017-08-10 22:29:40 +02:00
parent 5739487938
commit 54ae88aea3
2 changed files with 3 additions and 5 deletions

View File

@ -1400,7 +1400,7 @@ include("head.inc");
type: 'post',
data: 'isAjax=true&ipprotocol=inet' + defaultgw + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip),
error: function(request, textStatus, errorThrown){
if (textStatus === "error" && request.getResponseHeader("Content-Type") === "text/plain") {
if (textStatus === "error" && request.getResponseHeader("Content-Type").indexOf("text/plain") === 0) {
alert(request.responseText);
} else {
alert("Sorry, we could not create your IPv4 gateway at this time.");
@ -1433,7 +1433,7 @@ include("head.inc");
type: 'post',
data: 'isAjax=true&ipprotocol=inet6' + defaultgw + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip),
error: function(request, textStatus, errorThrown){
if (textStatus === "error" && request.getResponseHeader("Content-Type") === "text/plain") {
if (textStatus === "error" && request.getResponseHeader("Content-Type").indexOf("text/plain") === 0) {
alert(request.responseText);
} else {
alert("Sorry, we could not create your IPv6 gateway at this time.");

View File

@ -437,9 +437,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!empty($_REQUEST['isAjax'])) {
header("HTTP/1.0 500 Internal Server Error");
header("Content-type: text/plain");
foreach ($input_errors as $error) {
echo("$error\n");
}
echo implode("\n\n", $input_errors);
exit;
}