Skip to content

Commit

Permalink
Merge pull request #162 from herman322/fix-double-slash-in-path
Browse files Browse the repository at this point in the history
fix double slash issue if no pathPrefix specified
  • Loading branch information
trntv authored Jul 20, 2020
2 parents 0955c02 + b57a49e commit e7fbf1a
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 e7fbf1a

Please sign in to comment.