From 659ed3ecda733d53414528124014d5060fcb652e Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Thu, 14 Feb 2019 17:06:14 +0100 Subject: [PATCH 1/2] Prefix $path for filename for internal file cache Signed-off-by: Daniel Kesselberg --- apps/files_external/lib/Lib/Storage/AmazonS3.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 9d2e0c9109..6e381d5f15 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -309,7 +309,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { $files[] = $file; // store this information for later usage - $this->filesCache[$file] = [ + $this->filesCache[$path . $file] = [ 'ContentLength' => $object['Size'], 'LastModified' => (string)$object['LastModified'], ]; @@ -408,7 +408,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { } try { - if ($this->headObject($path)) { + if (isset($this->filesCache[$path]) && $this->headObject($path)) { return 'file'; } if ($this->headObject($path . '/')) { From 0d667d18bb9d76e8ffad48b270545dde76fc156e Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Thu, 14 Feb 2019 18:34:04 +0100 Subject: [PATCH 2/2] Call headObject if file not in filecache :see_no_evil: Signed-off-by: Daniel Kesselberg --- apps/files_external/lib/Lib/Storage/AmazonS3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 6e381d5f15..ea7ca42dfe 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -408,7 +408,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { } try { - if (isset($this->filesCache[$path]) && $this->headObject($path)) { + if (isset($this->filesCache[$path]) || $this->headObject($path)) { return 'file'; } if ($this->headObject($path . '/')) {