diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-12-01 21:13:28 +0300 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-12-01 21:16:36 +0300 |
commit | 7e272adf25f22b5f807d99aefd4f1efad08e0c51 (patch) | |
tree | 1b8a6f423408be190313ce0056bcf23df6937be6 | |
parent | 8468d7af8b38c81e4752069482dd44d241175edc (diff) |
[stable9] Catch status code 400
In case the server returns a statuscode 400 we should also gracefully return to the home directory.
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
-rw-r--r-- | apps/files/js/filelist.js | 2 | ||||
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index bcf6f991c50..8722ad7d27c 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1489,7 +1489,7 @@ return false; } - if (status === 404 || status === 405) { + if (status === 400 || status === 404 || status === 405) { // go back home this.changeDirectory('/'); return false; diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index e23a42ec4e9..47cfdbafcf9 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -1357,6 +1357,11 @@ describe('OCA.Files.FileList tests', function() { deferredList.reject(404); expect(fileList.getCurrentDirectory()).toEqual('/'); }); + it('switches to root dir when current directory returns 400', function() { + fileList.changeDirectory('/unexist'); + deferredList.reject(400); + expect(fileList.getCurrentDirectory()).toEqual('/'); + }); it('switches to root dir when current directory returns 405', function() { fileList.changeDirectory('/unexist'); deferredList.reject(405); |