diff --git a/app/code/core/Mage/Downloadable/Helper/File.php b/app/code/core/Mage/Downloadable/Helper/File.php index 31c39b5e635..27c55f65583 100644 --- a/app/code/core/Mage/Downloadable/Helper/File.php +++ b/app/code/core/Mage/Downloadable/Helper/File.php @@ -113,7 +113,7 @@ protected function _moveFileFromTmp($baseTmpPath, $basePath, $file) $this->getFilePath($basePath, $destFile) ); - $result = $ioObject->mv( + $ioObject->mv( $this->getFilePath($baseTmpPath, $file), $this->getFilePath($basePath, $destFile) ); @@ -129,6 +129,10 @@ protected function _moveFileFromTmp($baseTmpPath, $basePath, $file) */ public function getFilePath($path, $file) { + if (is_null($file) || $file === '') { + return $path . DS; + } + $file = $this->_prepareFileForPath($file); if (substr($file, 0, 1) == DS) { @@ -157,11 +161,7 @@ protected function _prepareFileForPath($file) */ public function getFileFromPathFile($pathFile) { - $file = ''; - - $file = substr($pathFile, strrpos($this->_prepareFileForPath($pathFile), DS) + 1); - - return $file; + return substr($pathFile, strrpos($this->_prepareFileForPath($pathFile), DS) + 1); } /**