summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-06-23 15:08:47 +0200
committerVincent Petry <pvince81@owncloud.com>2015-06-23 15:08:47 +0200
commite01db549a04136f0ddee11245aa3a1b4e6381cca (patch)
tree3bf5b1f7daf66d552ee880c9ebfc44d4df2a66fc
parentcce841c665a64aa161b023af59ac2136aaf424bf (diff)
parent5466dcadc005e352db70956441aaee01cda7c780 (diff)
downloadnextcloud-server-e01db549a04136f0ddee11245aa3a1b4e6381cca.tar.gz
nextcloud-server-e01db549a04136f0ddee11245aa3a1b4e6381cca.zip
Merge pull request #17048 from owncloud/hotfix/fix-firewall-blocking-dir-message
adding correct blocking logic for ffw
-rw-r--r--apps/files/js/filelist.js8
-rw-r--r--apps/files/tests/js/filelistSpec.js11
2 files changed, 19 insertions, 0 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index ed83c2be9df..5fc444e6121 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1123,6 +1123,14 @@
return false;
}
+ // Firewall Blocked request?
+ if (result.status === 403) {
+ // Go home
+ this.changeDirectory('/');
+ OC.Notification.show(t('files', 'This operation is forbidden'));
+ return false;
+ }
+
if (result.status === 404) {
// go back home
this.changeDirectory('/');
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index aa44c92792d..6bcef8b6f4f 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -1279,6 +1279,17 @@ describe('OCA.Files.FileList tests', function() {
fakeServer.respond();
expect(fileList.getCurrentDirectory()).toEqual('/');
});
+ it('switches to root dir when current directory is forbidden', function() {
+ fakeServer.respondWith(/\/index\.php\/apps\/files\/ajax\/list.php\?dir=%2funexist/, [
+ 403, {
+ "Content-Type": "application/json"
+ },
+ ''
+ ]);
+ fileList.changeDirectory('/unexist');
+ fakeServer.respond();
+ expect(fileList.getCurrentDirectory()).toEqual('/');
+ });
it('shows mask before loading file list then hides it at the end', function() {
var showMaskStub = sinon.stub(fileList, 'showMask');
var hideMaskStub = sinon.stub(fileList, 'hideMask');