diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-02-29 13:35:36 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-02-29 13:54:01 +0100 |
commit | ef2c312b18da7cfc8ef7da18068be282d0c49f55 (patch) | |
tree | ead5febbf320a71a962d4f9adf9a63dd759e8784 /core/js | |
parent | fa0e3d66ba2af3b51121fe19f5afd50309a36475 (diff) | |
download | nextcloud-server-ef2c312b18da7cfc8ef7da18068be282d0c49f55.tar.gz nextcloud-server-ef2c312b18da7cfc8ef7da18068be282d0c49f55.zip |
feat(settings): Migrate data directory protection check to `SetupCheck`
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/setupchecks.js | 26 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 43 |
2 files changed, 0 insertions, 69 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 598fb541136..d07ef6c9027 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -239,32 +239,6 @@ return deferred.promise(); }, - checkDataProtected: function() { - var deferred = $.Deferred(); - if(oc_dataURL === false){ - return deferred.resolve([]); - } - var afterCall = function(xhr) { - var messages = []; - // .ocdata is an empty file in the data directory - if this is readable then the data dir is not protected - if (xhr.status === 200 && xhr.responseText === '') { - messages.push({ - msg: t('core', 'Your data directory and files are probably accessible from the internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the web server document root.'), - type: OC.SetupChecks.MESSAGE_TYPE_ERROR - }); - } - deferred.resolve(messages); - }; - - $.ajax({ - type: 'GET', - url: OC.linkTo('', oc_dataURL+'/.ocdata?t=' + (new Date()).getTime()), - complete: afterCall, - allowAuthErrors: true - }); - return deferred.promise(); - }, - /** * Runs check for some generic security headers on the server side * diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 0f042c19942..03a2af7ed25 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -107,49 +107,6 @@ describe('OC.SetupChecks tests', function() { }); }); - describe('checkDataProtected', function() { - - oc_dataURL = "data"; - - it('should return an error if data directory is not protected', function(done) { - var async = OC.SetupChecks.checkDataProtected(); - - suite.server.requests[0].respond(200, {'Content-Type': 'text/plain'}, ''); - - async.done(function( data, s, x ){ - expect(data).toEqual([ - { - msg: 'Your data directory and files are probably accessible from the internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the web server document root.', - type: OC.SetupChecks.MESSAGE_TYPE_ERROR - }]); - done(); - }); - }); - - it('should not return an error if data directory is protected', function(done) { - var async = OC.SetupChecks.checkDataProtected(); - - suite.server.requests[0].respond(403); - - async.done(function( data, s, x ){ - expect(data).toEqual([]); - done(); - }); - }); - - it('should return an error if data directory is a boolean', function(done) { - - oc_dataURL = false; - - var async = OC.SetupChecks.checkDataProtected(); - - 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(); |