From 701c457ad414b5c103aacdb9922eb55408bde132 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 26 Jul 2019 16:57:05 -0700 Subject: [PATCH] Fix issue where reset of server was prematurely causing the drop of an ajax connection which was causing an error popup. --- .../resources/web/content/js/content.js | 22 ++++++++++++++----- domain-server/src/DomainServer.cpp | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/domain-server/resources/web/content/js/content.js b/domain-server/resources/web/content/js/content.js index ae9dc23536..9b5c807245 100644 --- a/domain-server/resources/web/content/js/content.js +++ b/domain-server/resources/web/content/js/content.js @@ -70,11 +70,23 @@ $(document).ready(function(){ var ajaxObject = $.ajax(ajaxParams); ajaxObject.fail(function (jqXHR, textStatus, errorThrown) { - showErrorMessage( - "Error", - "There was a problem restoring domain content.\n" - + "Please ensure that the content archive or entity file is valid and try again." - ); + // status of 0 means the connection was reset, which + // happens after the content is parsed and the server restarts + // in the case of json and json.gz files + if (jqXHR.status != 0) { + showErrorMessage( + "Error", + "There was a problem restoring domain content.\n" + + "Please ensure that the content archive or entity file is valid and try again." + ); + } else { + isRestoring = true; + + // immediately reload backup information since one should be restoring now + reloadBackupInformation(); + + swal.close(); + } }); updateProgressBars($('.upload-content-progress'), (offset + nextChunkSize) * 100 / fileSize); diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 3e8a56c82c..fa4bf89ad6 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -2190,7 +2190,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url return true; } else if (url.path() == URI_RESTART) { - connection->respond(HTTPConnection::StatusCode200); + connection->respond(HTTPConnection::StatusCode204); restart(); return true; } else if (url.path() == URI_API_METAVERSE_INFO) {