From 183618e89372b9370b848842f0d7d9ad22a9a60d Mon Sep 17 00:00:00 2001 From: wn_ Date: Fri, 2 Dec 2022 19:37:09 +0000 Subject: Prevent double slashes in full path. During housekeeping 'Cache_S3' gets initialized with an empty 'dir' value. This resulted in consecutive forward slashes in 'Cache_S3::get_full_path()', which prevented detection of directories and resulted in an empty list of rules. 'putBucketLifecycleConfiguration' with an empty list of rules causes a malformed XML error with AWS S3. --- init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init.php') diff --git a/init.php b/init.php index 7f8d5f5..10946c9 100644 --- a/init.php +++ b/init.php @@ -87,7 +87,7 @@ class Cache_S3 extends Plugin implements Cache_Adapter { } public function get_full_path(string $filename): string { - return 's3://' . Config::get(self::CACHE_S3_BUCKET) . '/' . $this->dir . '/' . basename(clean($filename)); + return 's3://' . Config::get(self::CACHE_S3_BUCKET) . '/' . ($this->dir ? $this->dir . '/' : '') . basename(clean($filename)); } public function get_mime_type(string $filename) { -- cgit v1.2.3