From e42b950521d2d4a2e9d6fc98970f611e4070bb78 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 7 Jun 2017 16:59:20 +0200 Subject: more efficient is_dir Signed-off-by: Robin Appelman --- apps/files_external/lib/Lib/Storage/AmazonS3.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'apps/files_external') diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 606a6b0189a..59d8fad5ac8 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -287,6 +287,16 @@ class AmazonS3 extends \OC\Files\Storage\Common { } } + public function is_dir($path) { + $path = $this->normalizePath($path); + try { + return $this->isRoot($path) || $this->getConnection()->doesObjectExist($this->bucket, $path . '/'); + } catch (S3Exception $e) { + \OCP\Util::logException('files_external', $e); + return false; + } + } + public function filetype($path) { $path = $this->normalizePath($path); -- cgit v1.2.3