Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
  • Loading branch information
LukasReschke committed Dec 1, 2016
commit 9704b4df5287b41dc80f83b032b406f664ae021c
2 changes: 1 addition & 1 deletion apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@
return false;
}

if (status === 404 || status === 405) {
if (status === 400 || status === 404 || status === 405) {
// go back home
this.changeDirectory('/');
return false;
Expand Down
5 changes: 5 additions & 0 deletions apps/files/tests/js/filelistSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,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);
Expand Down