[Pkg-owncloud-commits] [owncloud] 73/205: adding correct blocking logic for fff

David Prévot taffit at moszumanska.debian.org
Thu Jul 2 17:36:57 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 5466dcadc005e352db70956441aaee01cda7c780
Author: Clark Tomlinson <fallen013 at gmail.com>
Date:   Fri Jun 19 10:31:22 2015 -0400

    adding correct blocking logic for fff
---
 apps/files/js/filelist.js           |  8 ++++++++
 apps/files/tests/js/filelistSpec.js | 11 +++++++++++
 2 files changed, 19 insertions(+)

diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index b6f464b..ab56b1a 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 aa44c92..6bcef8b 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');

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list