Skip to content

Commit

Permalink
fix double slash issue if no pathPrefix specified
Browse files Browse the repository at this point in the history
  • Loading branch information
HermanHilbrektas committed Jul 14, 2020
1 parent 0955c02 commit b57a49e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit b57a49e

Please sign in to comment.