From b57a49e0d6be5697b7c81d957c9e6e1d678ac836 Mon Sep 17 00:00:00 2001 From: HermanHilbrektas Date: Tue, 14 Jul 2020 12:01:47 +0300 Subject: [PATCH] fix double slash issue if no pathPrefix specified --- src/Storage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Storage.php b/src/Storage.php index edc43ae..17d8cc0 100644 --- a/src/Storage.php +++ b/src/Storage.php @@ -129,11 +129,11 @@ public function save($file, $preserveFileName = false, $overwrite = false, $conf Yii::$app->security->generateRandomString(), $fileObj->getExtension() ]); - $path = implode(DIRECTORY_SEPARATOR, [$pathPrefix, $dirIndex, $filename]); + $path = implode(DIRECTORY_SEPARATOR, array_filter([$pathPrefix, $dirIndex, $filename])); } while ($this->getFilesystem()->has($path)); } else { $filename = $fileObj->getPathInfo('filename'); - $path = implode(DIRECTORY_SEPARATOR, [$pathPrefix, $dirIndex, $filename]); + $path = implode(DIRECTORY_SEPARATOR, array_filter([$pathPrefix, $dirIndex, $filename])); } $this->beforeSave($fileObj->getPath(), $this->getFilesystem());