summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwn_ <[email protected]>2022-12-02 19:37:09 +0000
committerwn_ <[email protected]>2022-12-02 19:37:29 +0000
commit183618e89372b9370b848842f0d7d9ad22a9a60d (patch)
tree29ea39a8b4686f0892294c65161c8144ddd3913c
parent188df4f99a79485b6d8bd353bf384e4a7eec11df (diff)
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.
-rw-r--r--init.php2
1 files changed, 1 insertions, 1 deletions
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) {