Skip to content

Commit 11aac9e

Browse files
authored
Merge pull request #13357 from nextcloud/backport/13134/stable15
[stable15] returns a 404 instead of exception if app is not installed - #13088
2 parents aaba0ad + 67ebcf8 commit 11aac9e

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

core/js/setupchecks.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,16 @@
5252
* @param url the URL to test
5353
* @param placeholderUrl the placeholder URL - can be found at oc_defaults.docPlaceholderUrl
5454
* @param {boolean} runCheck if this is set to false the check is skipped and no error is returned
55-
* @param {int} expectedStatus the expected HTTP status to be returned by the URL, 207 by default
55+
* @param {int|int[]} expectedStatus the expected HTTP status to be returned by the URL, 207 by default
5656
* @return $.Deferred object resolved with an array of error messages
5757
*/
5858
checkWellKnownUrl: function(url, placeholderUrl, runCheck, expectedStatus) {
5959
if (expectedStatus === undefined) {
60-
expectedStatus = 207;
60+
expectedStatus = [207];
61+
}
62+
63+
if (!Array.isArray(expectedStatus)) {
64+
expectedStatus = [expectedStatus];
6165
}
6266

6367
var deferred = $.Deferred();
@@ -68,7 +72,7 @@
6872
}
6973
var afterCall = function(xhr) {
7074
var messages = [];
71-
if (xhr.status !== expectedStatus) {
75+
if (expectedStatus.indexOf(xhr.status) === -1) {
7276
var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-setup-well-known-URL');
7377
messages.push({
7478
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 }),

public.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
OC_App::loadApps(array('filesystem', 'logging'));
6969

7070
if (!\OC::$server->getAppManager()->isInstalled($app)) {
71-
throw new Exception('App not installed: ' . $app);
71+
http_response_code(501);
72+
exit;
7273
}
7374
OC_App::loadApp($app);
7475
OC_User::setIncognitoMode(true);

settings/js/admin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ $(document).ready(function(){
247247
// run setup checks then gather error messages
248248
$.when(
249249
OC.SetupChecks.checkWebDAV(),
250-
OC.SetupChecks.checkWellKnownUrl('/.well-known/webfinger', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true && !!oc_appconfig.core.public_webfinger, 200),
250+
OC.SetupChecks.checkWellKnownUrl('/.well-known/webfinger', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true && !!oc_appconfig.core.public_webfinger, [200, 501]),
251251
OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),
252252
OC.SetupChecks.checkWellKnownUrl('/.well-known/carddav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),
253253
OC.SetupChecks.checkSetup(),

0 commit comments

Comments
 (0)