[Pkg-owncloud-commits] [owncloud] 145/205: add check if server returns a 500 and display error
David Prévot
taffit at moszumanska.debian.org
Thu Jul 2 17:37:06 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 ca1da0acb7f02bab9385fa3cbe3fe4453a13de82
Author: Clark Tomlinson <fallen013 at gmail.com>
Date: Fri Jun 26 11:19:59 2015 -0400
add check if server returns a 500 and display error
resolves https://github.com/owncloud/core/issues/17170
---
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 5fc444e..417c4b9 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1131,6 +1131,14 @@
return false;
}
+ // Did share service die or something else fail?
+ if (result.status === 500) {
+ // Go home
+ this.changeDirectory('/');
+ OC.Notification.show(t('files', 'This directory is unavailable, please check the logs or contact the administrator'));
+ 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 6bcef8b..b12ac2f 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -1290,6 +1290,17 @@ describe('OCA.Files.FileList tests', function() {
fakeServer.respond();
expect(fileList.getCurrentDirectory()).toEqual('/');
});
+ it('switches to root dir when current directory is unavailable', function() {
+ fakeServer.respondWith(/\/index\.php\/apps\/files\/ajax\/list.php\?dir=%2funexist/, [
+ 500, {
+ "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