File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
lib/internal/Magento/Framework/File Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -39,10 +39,11 @@ public function __construct(TargetDirectory $targetDirectory = null)
39
39
public function getNewFileName (string $ destinationFile )
40
40
{
41
41
$ fileInfo = $ this ->getPathInfo ($ destinationFile );
42
- if ($ this ->targetDirectory ->getDirectoryWrite (DirectoryList::ROOT )->isExist ($ destinationFile )) {
42
+ $ directory = $ this ->targetDirectory ->getDirectoryWrite (DirectoryList::ROOT );
43
+ if ($ directory ->isExist ($ destinationFile )) {
43
44
$ index = 1 ;
44
45
$ baseName = $ fileInfo ['filename ' ] . '. ' . $ fileInfo ['extension ' ];
45
- while ($ this -> targetDirectory -> getDirectoryWrite (DirectoryList:: ROOT ) ->isExist ($ fileInfo ['dirname ' ] . '/ ' . $ baseName )) {
46
+ while ($ directory ->isExist ($ fileInfo ['dirname ' ] . '/ ' . $ baseName )) {
46
47
$ baseName = $ fileInfo ['filename ' ] . '_ ' . $ index . '. ' . $ fileInfo ['extension ' ];
47
48
$ index ++;
48
49
}
You can’t perform that action at this time.
0 commit comments