adding correct blocking logic for fff
This commit is contained in:
parent
5ed9743570
commit
5466dcadc0
|
@ -1123,6 +1123,14 @@
|
||||||
return false;
|
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) {
|
if (result.status === 404) {
|
||||||
// go back home
|
// go back home
|
||||||
this.changeDirectory('/');
|
this.changeDirectory('/');
|
||||||
|
|
|
@ -1279,6 +1279,17 @@ describe('OCA.Files.FileList tests', function() {
|
||||||
fakeServer.respond();
|
fakeServer.respond();
|
||||||
expect(fileList.getCurrentDirectory()).toEqual('/');
|
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() {
|
it('shows mask before loading file list then hides it at the end', function() {
|
||||||
var showMaskStub = sinon.stub(fileList, 'showMask');
|
var showMaskStub = sinon.stub(fileList, 'showMask');
|
||||||
var hideMaskStub = sinon.stub(fileList, 'hideMask');
|
var hideMaskStub = sinon.stub(fileList, 'hideMask');
|
||||||
|
|
Loading…
Reference in New Issue