From a3be28627364342ac3373075a0f4a7d1688c49f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 18 Dec 2018 19:53:18 +0100 Subject: [PATCH] Make setup check also pass with a 501 status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/js/setupchecks.js | 10 +++++++--- settings/js/admin.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 343b676080..025f58bca8 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -52,12 +52,16 @@ * @param url the URL to test * @param placeholderUrl the placeholder URL - can be found at oc_defaults.docPlaceholderUrl * @param {boolean} runCheck if this is set to false the check is skipped and no error is returned - * @param {int} expectedStatus the expected HTTP status to be returned by the URL, 207 by default + * @param {int|int[]} expectedStatus the expected HTTP status to be returned by the URL, 207 by default * @return $.Deferred object resolved with an array of error messages */ checkWellKnownUrl: function(url, placeholderUrl, runCheck, expectedStatus) { if (expectedStatus === undefined) { - expectedStatus = 207; + expectedStatus = [207]; + } + + if (!Array.isArray(expectedStatus)) { + expectedStatus = [expectedStatus]; } var deferred = $.Deferred(); @@ -68,7 +72,7 @@ } var afterCall = function(xhr) { var messages = []; - if (xhr.status !== expectedStatus) { + if (expectedStatus.indexOf(xhr.status) === -1) { var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-setup-well-known-URL'); messages.push({ msg: t('core', 'Your web server is not properly set up to resolve "{url}". Further information can be found in the documentation.', { docLink: docUrl, url: url }), diff --git a/settings/js/admin.js b/settings/js/admin.js index 2f3cc0356c..8c198bc782 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -247,7 +247,7 @@ $(document).ready(function(){ // run setup checks then gather error messages $.when( OC.SetupChecks.checkWebDAV(), - OC.SetupChecks.checkWellKnownUrl('/.well-known/webfinger', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true && !!oc_appconfig.core.public_webfinger, 200), + OC.SetupChecks.checkWellKnownUrl('/.well-known/webfinger', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true && !!oc_appconfig.core.public_webfinger, [200, 501]), OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), OC.SetupChecks.checkWellKnownUrl('/.well-known/carddav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true), OC.SetupChecks.checkSetup(),