switch method to detect if a directory is readable

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2019-11-15 13:47:57 +01:00
parent 6c3a4a7106
commit 193407add0
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 2 additions and 8 deletions

View File

@ -201,17 +201,11 @@ class SMB extends Common implements INotifyStorage {
protected function directoryIsReadable(string $path): bool {
try {
// SMB doesn't seem to have a way to get the permissions of a folder, so instead we
// have to use a workaround
//
// if we try to access a file in a folder we dont have access to we get a Forbidden
// if we do have access we got a not found
$this->share->stat($path . '/__non_existing__' . uniqid());
$this->share->dir($path);
} catch (ForbiddenException $e) {
return false;
} catch (NotFoundException $e) {
return true;
}
return true;
}
/**