Skip to content

Commit b57a49e

Browse files
author
HermanHilbrektas
committed
fix double slash issue if no pathPrefix specified
1 parent 0955c02 commit b57a49e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Storage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ public function save($file, $preserveFileName = false, $overwrite = false, $conf
129129
Yii::$app->security->generateRandomString(),
130130
$fileObj->getExtension()
131131
]);
132-
$path = implode(DIRECTORY_SEPARATOR, [$pathPrefix, $dirIndex, $filename]);
132+
$path = implode(DIRECTORY_SEPARATOR, array_filter([$pathPrefix, $dirIndex, $filename]));
133133
} while ($this->getFilesystem()->has($path));
134134
} else {
135135
$filename = $fileObj->getPathInfo('filename');
136-
$path = implode(DIRECTORY_SEPARATOR, [$pathPrefix, $dirIndex, $filename]);
136+
$path = implode(DIRECTORY_SEPARATOR, array_filter([$pathPrefix, $dirIndex, $filename]));
137137
}
138138

139139
$this->beforeSave($fileObj->getPath(), $this->getFilesystem());

0 commit comments

Comments
 (0)