diff options
author | Robin Appelman <robin@icewind.nl> | 2021-10-14 18:36:55 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-10-15 15:35:06 +0200 |
commit | 5e3c8b3af2f2b25fcadc9aaf3ed10afa6e1d63c4 (patch) | |
tree | 31bb5e6b53f937dbf3833677ed4d9e2e16df6ccb /apps/files_external/lib | |
parent | 09ffac5e6dd5355c9aaf49c098942fa1e4fbed25 (diff) | |
download | nextcloud-server-5e3c8b3af2f2b25fcadc9aaf3ed10afa6e1d63c4.tar.gz nextcloud-server-5e3c8b3af2f2b25fcadc9aaf3ed10afa6e1d63c4.zip |
doesDirectoryExist fixes
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/AmazonS3.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index f85797d29f4..1ad1cd699d3 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -46,7 +46,6 @@ use Icewind\Streams\CallbackWrapper; use Icewind\Streams\IteratorDirectory; use OC\Cache\CappedMemoryCache; use OC\Files\Cache\CacheEntry; -use OC\Files\Filesystem; use OC\Files\ObjectStore\S3ConnectionTrait; use OC\Files\ObjectStore\S3ObjectTrait; use OCP\Constants; @@ -174,6 +173,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { if ($path === '.' || $path === '') { return true; } + $path = rtrim($path, '/') . '/'; if (isset($this->directoryCache[$path])) { return $this->directoryCache[$path]; @@ -183,7 +183,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { // Do a prefix listing of objects to determine. $result = $this->getConnection()->listObjectsV2([ 'Bucket' => $this->bucket, - 'Prefix' => rtrim($path, '/'), + 'Prefix' => $path, 'MaxKeys' => 1, ]); @@ -360,7 +360,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { return IteratorDirectory::wrap(array_map(function (array $item) { return $item['name']; }, $content)); - } catch (S3Exception $e) { + } catch (S3Exception $e) { return false; } } @@ -435,7 +435,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { } try { - return $this->isRoot($path) || $this->doesDirectoryExist($path); + return $this->doesDirectoryExist($path); } catch (S3Exception $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); return false; |