handle forbidden exceptions in smb backend

This commit is contained in:
Robin Appelman 2016-02-10 16:41:58 +01:00
parent 9a2c517ca8
commit edbe5d7b6d
1 changed files with 18 additions and 1 deletions

View File

@ -30,6 +30,7 @@
namespace OC\Files\Storage;
use Icewind\SMB\Exception\Exception;
use Icewind\SMB\Exception\ForbiddenException;
use Icewind\SMB\Exception\NotFoundException;
use Icewind\SMB\NativeServer;
use Icewind\SMB\Server;
@ -159,6 +160,8 @@ class SMB extends Common {
}
} catch (NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
}
}
@ -239,6 +242,8 @@ class SMB extends Common {
return false;
} catch (NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
}
}
@ -257,6 +262,8 @@ class SMB extends Common {
return true;
} catch (NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
}
}
@ -270,7 +277,13 @@ class SMB extends Common {
}
public function opendir($path) {
$files = $this->getFolderContents($path);
try {
$files = $this->getFolderContents($path);
} catch (NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
}
$names = array_map(function ($info) {
/** @var \Icewind\SMB\IFileInfo $info */
return $info->getName();
@ -283,6 +296,8 @@ class SMB extends Common {
return $this->getFileInfo($path)->isDirectory() ? 'dir' : 'file';
} catch (NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
}
}
@ -302,6 +317,8 @@ class SMB extends Common {
return true;
} catch (NotFoundException $e) {
return false;
} catch (ForbiddenException $e) {
return false;
}
}