Skip to content

Commit

Permalink
⏫ Forwardport of #12507 to 2.3-develop branch
Browse files Browse the repository at this point in the history
Applied pull request patch https://github.com/magento/magento2/pull/12507.patch (created by @PascalBrouwers) based on commit(s):
  1. 9c5420f
  2. daee4a8

Fixed GitHub Issues in 2.3-develop branch:
  - #12506: Fixup typo getDispretionPath -> getDispersionPath (reported by @PascalBrouwers)
  • Loading branch information
magento-engcom-team committed Jan 24, 2018
1 parent 8e77e2f commit 21cfb6a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
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

0 comments on commit 21cfb6a

Please sign in to comment.