Avoid showing HTML code from gateway if server is not running
This commit is contained in:
parent
4f79e9e069
commit
74b4b833da
|
@ -38,6 +38,8 @@ export function queryRoute(method, path, callback, type)
|
||||||
return window.alert('Authentication failed. Try again.');
|
return window.alert('Authentication failed. Try again.');
|
||||||
default:
|
default:
|
||||||
try {
|
try {
|
||||||
|
// avoid showing HTML code from gateway
|
||||||
|
ajaxRequest.responseTextDisplay = ajaxRequest.status >= 500 || ajaxRequest.status < 600 ? 'internal server error' : ajaxRequest.responseText;
|
||||||
return callback(this, status === 200);
|
return callback(this, status === 200);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
window.alert('Unable to process server response: ' + e);
|
window.alert('Unable to process server response: ' + e);
|
||||||
|
|
|
@ -250,13 +250,14 @@ function renderBuildActionActions(actionValue, buildAction, detailsTable)
|
||||||
|
|
||||||
function showBuildActions(ajaxRequest)
|
function showBuildActions(ajaxRequest)
|
||||||
{
|
{
|
||||||
if (!window.globalInfo) {
|
if (!window.globalInfo && ajaxRequest.status === 200) {
|
||||||
window.functionsPostponedUntilGlobalInfo.push(showBuildActions.bind(this, ...arguments));
|
window.functionsPostponedUntilGlobalInfo.push(showBuildActions.bind(this, ...arguments));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const buildActionsList = Utils.getAndEmptyElement('build-actions-list');
|
const buildActionsList = Utils.getAndEmptyElement('build-actions-list');
|
||||||
if (ajaxRequest.status !== 200) {
|
if (ajaxRequest.status !== 200) {
|
||||||
buildActionsList.appendChild(document.createTextNode('Unable to load build actions: ' + ajaxRequest.responseText));
|
buildActionsList.appendChild(document.createTextNode('Unable to load build actions: ' + ajaxRequest.responseTextDisplay));
|
||||||
|
buildActionsList.appendChild(document.createTextNode(' '));
|
||||||
buildActionsList.appendChild(CustomRendering.renderReloadButton(queryBuildActions));
|
buildActionsList.appendChild(CustomRendering.renderReloadButton(queryBuildActions));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,10 @@ function handleGlobalStatusUpdate(ajaxRequest)
|
||||||
{
|
{
|
||||||
const globalStatus = Utils.getAndEmptyElement('global-status');
|
const globalStatus = Utils.getAndEmptyElement('global-status');
|
||||||
let responseText = ajaxRequest.responseText;
|
let responseText = ajaxRequest.responseText;
|
||||||
if (ajaxRequest.status === 500) {
|
|
||||||
responseText = 'internal server error';
|
|
||||||
}
|
|
||||||
if (ajaxRequest.status !== 200) {
|
if (ajaxRequest.status !== 200) {
|
||||||
globalStatus.appendChild(document.createTextNode('unable to load global status: ' + responseText));
|
globalStatus.appendChild(document.createTextNode('unable to load global status: ' + ajaxRequest.responseTextDisplay));
|
||||||
|
globalStatus.appendChild(document.createTextNode(' '));
|
||||||
|
globalStatus.appendChild(CustomRendering.renderReloadButton(queryGlobalStatus));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const responseJson = JSON.parse(responseText);
|
const responseJson = JSON.parse(responseText);
|
||||||
|
|
|
@ -156,7 +156,7 @@ export function showPackageDetails(ajaxRequest, row)
|
||||||
const packageID = makePackageID(row);
|
const packageID = makePackageID(row);
|
||||||
const packageDetailsContainer = Utils.getAndEmptyElement('package-details-container');
|
const packageDetailsContainer = Utils.getAndEmptyElement('package-details-container');
|
||||||
if (ajaxRequest.status !== 200) {
|
if (ajaxRequest.status !== 200) {
|
||||||
packageDetailsContainer.appendChild(document.createTextNode('unable query package details: ' + ajaxRequest.responseText));
|
packageDetailsContainer.appendChild(document.createTextNode('unable query package details: ' + ajaxRequest.responseTextDisplay));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const responseJson = JSON.parse(ajaxRequest.responseText);
|
const responseJson = JSON.parse(ajaxRequest.responseText);
|
||||||
|
|
|
@ -108,7 +108,7 @@ function showPackageSearchResults(ajaxRequest)
|
||||||
{
|
{
|
||||||
const packageSearchResults = Utils.getAndEmptyElement('package-search-results');
|
const packageSearchResults = Utils.getAndEmptyElement('package-search-results');
|
||||||
if (ajaxRequest.status !== 200) {
|
if (ajaxRequest.status !== 200) {
|
||||||
packageSearchResults.appendChild(document.createTextNode('unable search for packages: ' + ajaxRequest.responseText));
|
packageSearchResults.appendChild(document.createTextNode('unable search for packages: ' + ajaxRequest.responseTextDisplay));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const responseJson = JSON.parse(ajaxRequest.responseText);
|
const responseJson = JSON.parse(ajaxRequest.responseText);
|
||||||
|
|
Loading…
Reference in New Issue