@@ -366,7 +366,7 @@ public function getDirsCollection($path)
366
366
->setCollectRecursively (false )
367
367
->setOrder ('basename ' , \Magento \Framework \Data \Collection \Filesystem::SORT_ORDER_ASC );
368
368
369
- if (!$ this ->isPathAllowed ($ path )) {
369
+ if (!$ this ->isDirectoryAllowed ($ path )) {
370
370
$ collection ->setDirsFilter ($ this ->getAllowedDirMask ($ path ));
371
371
}
372
372
@@ -486,7 +486,7 @@ public function createDirectory($name, $path)
486
486
);
487
487
}
488
488
489
- if (!($ this ->isPathAllowed (rtrim ($ path , '/ ' ) . '/ ' . $ name ))) {
489
+ if (!($ this ->isDirectoryAllowed (rtrim ($ path , '/ ' ) . '/ ' . $ name ))) {
490
490
throw new \Magento \Framework \Exception \LocalizedException (
491
491
__ ('We cannot create the folder under the selected directory. ' )
492
492
);
@@ -533,7 +533,7 @@ public function createDirectory($name, $path)
533
533
*/
534
534
public function deleteDirectory ($ path )
535
535
{
536
- if (!$ this ->isPathAllowed (dirname ($ path ))) {
536
+ if (!$ this ->isDirectoryAllowed (dirname ($ path ))) {
537
537
throw new \Magento \Framework \Exception \LocalizedException (
538
538
__ ('We cannot delete the selected directory. ' )
539
539
);
@@ -582,7 +582,7 @@ protected function _deleteByPath($path)
582
582
*/
583
583
public function deleteFile ($ target )
584
584
{
585
- if (!$ this ->isPathAllowed (dirname ($ target ))) {
585
+ if (!$ this ->isDirectoryAllowed (dirname ($ target ))) {
586
586
throw new \Magento \Framework \Exception \LocalizedException (
587
587
__ ('We can \'t delete the file right now. ' )
588
588
);
@@ -614,7 +614,7 @@ public function deleteFile($target)
614
614
*/
615
615
public function uploadFile ($ targetPath , $ type = null )
616
616
{
617
- if (!($ this ->isPathAllowed ($ targetPath ))) {
617
+ if (!($ this ->isDirectoryAllowed ($ targetPath ))) {
618
618
throw new \Magento \Framework \Exception \LocalizedException (
619
619
__ ('We can \'t upload the file to the current folder right now. Please try another folder. ' )
620
620
);
@@ -966,16 +966,16 @@ private function getExtensionsList($type = null): array
966
966
}
967
967
968
968
/**
969
- * Check if path is allowed
969
+ * Check if directory is allowed
970
970
*
971
- * @param string $path Absolute path
971
+ * @param string $directoryPath Absolute path to a directory
972
972
* @return bool
973
973
*/
974
- private function isPathAllowed ( $ path ): bool
974
+ private function isDirectoryAllowed ( $ directoryPath ): bool
975
975
{
976
976
$ storageRoot = $ this ->_cmsWysiwygImages ->getStorageRoot ();
977
977
$ storageRootLength = strlen ($ storageRoot );
978
- $ mediaSubPathname = substr ($ path , $ storageRootLength );
978
+ $ mediaSubPathname = substr ($ directoryPath , $ storageRootLength );
979
979
if (!$ mediaSubPathname ) {
980
980
return false ;
981
981
}
0 commit comments