Skip to content

Commit e7fbf1a

Browse files
authored
Merge pull request #162 from herman322/fix-double-slash-in-path
fix double slash issue if no pathPrefix specified
2 parents 0955c02 + b57a49e commit e7fbf1a

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)