diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-01-04 17:08:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-04 17:08:04 +0100 |
commit | 0aa30b76de6879ac62883962b7cd90b32ef14f48 (patch) | |
tree | a02f1d6db80b9258561553af007f2178806b2760 | |
parent | 9134ef08ec0b92e2c378b6c6f8f450dd6a4d9bb0 (diff) | |
parent | a3be28627364342ac3373075a0f4a7d1688c49f2 (diff) | |
download | nextcloud-server-0aa30b76de6879ac62883962b7cd90b32ef14f48.tar.gz nextcloud-server-0aa30b76de6879ac62883962b7cd90b32ef14f48.zip |
Merge pull request #13134 from nextcloud/bugfix/13088/404-instead-of-exception
returns a 404 instead of exception if app is not installed - #13088
-rw-r--r-- | core/js/setupchecks.js | 10 | ||||
-rw-r--r-- | public.php | 3 | ||||
-rw-r--r-- | settings/js/admin.js | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index cca3707acdf..4aa60912c37 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 <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation</a>.', { docLink: docUrl, url: url }), diff --git a/public.php b/public.php index f033e1897c8..ae95624e8d9 100644 --- a/public.php +++ b/public.php @@ -68,7 +68,8 @@ try { OC_App::loadApps(array('filesystem', 'logging')); if (!\OC::$server->getAppManager()->isInstalled($app)) { - throw new Exception('App not installed: ' . $app); + http_response_code(501); + exit; } OC_App::loadApp($app); OC_User::setIncognitoMode(true); diff --git a/settings/js/admin.js b/settings/js/admin.js index 2f3cc0356c9..8c198bc7821 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(), |