Skip to content

Commit

Permalink
Merge pull request #92 from nextcloud/stable9-fix-htaccess-warning
Browse files Browse the repository at this point in the history
[stable9] Fix data directory warning
  • Loading branch information
LukasReschke authored Jun 14, 2016
2 parents 326dcd7 + 6efe6b4 commit 7a5093c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/js/setupchecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions core/js/tests/specs/setupchecksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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();

Expand Down

0 comments on commit 7a5093c

Please sign in to comment.