diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-03-14 16:20:17 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-03-14 16:20:17 +0100 |
commit | 443b26761ddb80e8724b4eab1076f349cf62f6fd (patch) | |
tree | 379c0b6b835abe671b09f22a371f811da4d93e67 /core | |
parent | d435f0c3d3543db8f425c0e6da37487336c6daec (diff) | |
download | nextcloud-server-443b26761ddb80e8724b4eab1076f349cf62f6fd.tar.gz nextcloud-server-443b26761ddb80e8724b4eab1076f349cf62f6fd.zip |
fix: Migrate WebDAV endpoint check to SetupCheck API
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/js/setupchecks.js | 31 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 38 |
2 files changed, 0 insertions, 69 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 0c0e673eae7..fd27dbc0791 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -15,37 +15,6 @@ MESSAGE_TYPE_INFO:0, MESSAGE_TYPE_WARNING:1, MESSAGE_TYPE_ERROR:2, - /** - * Check whether the WebDAV connection works. - * - * @return $.Deferred object resolved with an array of error messages - */ - checkWebDAV: function() { - var deferred = $.Deferred(); - var afterCall = function(xhr) { - var messages = []; - if (xhr.status !== 207 && xhr.status !== 401) { - messages.push({ - msg: t('core', 'Your web server is not yet properly set up to allow file synchronization, because the WebDAV interface seems to be broken.'), - type: OC.SetupChecks.MESSAGE_TYPE_ERROR - }); - } - deferred.resolve(messages); - }; - - $.ajax({ - type: 'PROPFIND', - url: OC.linkToRemoteBase('webdav'), - data: '<?xml version="1.0"?>' + - '<d:propfind xmlns:d="DAV:">' + - '<d:prop><d:resourcetype/></d:prop>' + - '</d:propfind>', - contentType: 'application/xml; charset=utf-8', - complete: afterCall, - allowAuthErrors: true - }); - return deferred.promise(); - }, /** * Runs setup checks on the server side diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 99f72754ace..dc5db7602ff 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -22,44 +22,6 @@ describe('OC.SetupChecks tests', function() { protocolStub.restore(); }); - describe('checkWebDAV', function() { - it('should fail with another response status code than 201 or 207', function(done) { - var async = OC.SetupChecks.checkWebDAV(); - - suite.server.requests[0].respond(200); - - async.done(function( data, s, x ){ - expect(data).toEqual([{ - msg: 'Your web server is not yet properly set up to allow file synchronization, because the WebDAV interface seems to be broken.', - type: OC.SetupChecks.MESSAGE_TYPE_ERROR - }]); - done(); - }); - }); - - it('should return no error with a response status code of 207', function(done) { - var async = OC.SetupChecks.checkWebDAV(); - - suite.server.requests[0].respond(207); - - async.done(function( data, s, x ){ - expect(data).toEqual([]); - done(); - }); - }); - - it('should return no error with a response status code of 401', function(done) { - var async = OC.SetupChecks.checkWebDAV(); - - suite.server.requests[0].respond(401); - - async.done(function( data, s, x ){ - expect(data).toEqual([]); - done(); - }); - }); - }); - describe('checkSetup', function() { it('should return an error if server has no internet connection', function(done) { var async = OC.SetupChecks.checkSetup(); |