Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function addImage(
}

$fileName = \Magento\MediaStorage\Model\File\Uploader::getCorrectFileName($pathinfo['basename']);
$dispretionPath = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName);
$dispretionPath = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName);
$fileName = $dispretionPath . '/' . $fileName;

$fileName = $this->getNotDuplicatedFilename($fileName, $dispretionPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function validate($processingParams, $option)
$extension = pathinfo(strtolower($fileInfo['name']), PATHINFO_EXTENSION);

$fileName = \Magento\MediaStorage\Model\File\Uploader::getCorrectFileName($fileInfo['name']);
$dispersion = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName);
$dispersion = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName);

$filePath = $dispersion;

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Customer/Model/FileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function moveTemporaryFile($fileName)
{
$fileName = ltrim($fileName, '/');

$dispersionPath = \Magento\MediaStorage\Model\File\Uploader::getDispretionPath($fileName);
$dispersionPath = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName);
$destinationPath = $this->entityTypeCode . $dispersionPath;

if (!$this->mediaDirectory->create($destinationPath)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function execute()
$remoteFileUrl = $this->getRequest()->getParam('remote_image');
$this->validateRemoteFile($remoteFileUrl);
$localFileName = Uploader::getCorrectFileName(basename($remoteFileUrl));
$localTmpFileName = Uploader::getDispretionPath($localFileName) . DIRECTORY_SEPARATOR . $localFileName;
$localTmpFileName = Uploader::getDispersionPath($localFileName) . DIRECTORY_SEPARATOR . $localFileName;
$localFilePath = $baseTmpMediaPath . ($localTmpFileName);
$localUniqFilePath = $this->appendNewFileName($localFilePath);
$this->validateRemoteFileExtensions($localUniqFilePath);
Expand Down Expand Up @@ -174,7 +174,7 @@ private function validateRemoteFileExtensions($filePath)
protected function appendResultSaveRemoteImage($fileName)
{
$fileInfo = pathinfo($fileName);
$tmpFileName = Uploader::getDispretionPath($fileInfo['basename']) . DIRECTORY_SEPARATOR . $fileInfo['basename'];
$tmpFileName = Uploader::getDispersionPath($fileInfo['basename']) . DIRECTORY_SEPARATOR . $fileInfo['basename'];
$result['name'] = $fileInfo['basename'];
$result['type'] = $this->imageAdapter->getMimeType();
$result['error'] = 0;
Expand Down
14 changes: 13 additions & 1 deletion lib/internal/Magento/Framework/File/Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function save($destinationFolder, $newFileName = null)
if ($this->_enableFilesDispersion) {
$fileName = $this->correctFileNameCase($fileName);
$this->setAllowCreateFolders(true);
$this->_dispretionPath = self::getDispretionPath($fileName);
$this->_dispretionPath = self::getDispersionPath($fileName);
$destinationFile .= $this->_dispretionPath;
$this->_createDestinationFolder($destinationFile);
}
Expand Down Expand Up @@ -610,8 +610,20 @@ public static function getNewFileName($destinationFile)
*
* @param string $fileName
* @return string
* @deprecated
*/
public static function getDispretionPath($fileName)
{
return self::getDispersionPath($fileName);
}

/**
* Get dispertion path
*
* @param string $fileName
* @return string
*/
public static function getDispersionPath($fileName)
{
$char = 0;
$dispertionPath = '';
Expand Down