Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-06-14 14:28:09 +0300
committerLukas Reschke <lukas@owncloud.com>2016-06-14 14:29:38 +0300
commit6efe6b47ba0501d7457b0f8705087b151e1fb670 (patch)
tree7cb0616c956761b29c31cfe674ded2317009421d
parent326dcd7b66a2b0dfac9ebbd6cbab9f63d6d94bab (diff)
Fix data directory warning
Otherwise always the warning is displayed that the data directory is accessible from the internet when URLs without index.php are enabled. Fixes https://github.com/nextcloud/server/issues/91
-rw-r--r--core/js/setupchecks.js2
-rw-r--r--core/js/tests/specs/setupchecksSpec.js15
2 files changed, 14 insertions, 3 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index ee93781b074..2995802ad96 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -197,7 +197,7 @@
}
var afterCall = function(xhr) {
var messages = [];
- if (xhr.status !== 403 && xhr.status !== 307 && xhr.status !== 301 && xhr.responseText !== '') {
+ if (xhr.status !== 403 && xhr.status !== 307 && xhr.status !== 301 && xhr.responseText === 'This is used for testing whether htaccess is properly enabled to disallow access from the outside. This file can be safely removed.') {
messages.push({
msg: t('core', 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.'),
type: OC.SetupChecks.MESSAGE_TYPE_ERROR
diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js
index 9e2f0f49010..e0293d0c031 100644
--- a/core/js/tests/specs/setupchecksSpec.js
+++ b/core/js/tests/specs/setupchecksSpec.js
@@ -103,7 +103,7 @@ describe('OC.SetupChecks tests', function() {
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'}, 'file contents');
+ suite.server.requests[0].respond(200, {'Content-Type': 'text/plain'}, 'This is used for testing whether htaccess is properly enabled to disallow access from the outside. This file can be safely removed.');
async.done(function( data, s, x ){
expect(data).toEqual([
@@ -114,7 +114,18 @@ describe('OC.SetupChecks tests', function() {
done();
});
});
-
+
+ it('should return no error if data directory is protected and returns another content', function(done) {
+ var async = OC.SetupChecks.checkDataProtected();
+
+ suite.server.requests[0].respond(200, {'Content-Type': 'text/plain'}, 'Another page');
+
+ async.done(function( data, s, x ){
+ expect(data).toEqual([]);
+ done();
+ });
+ });
+
it('should not return an error if data directory is protected', function(done) {
var async = OC.SetupChecks.checkDataProtected();