Skip to content

Commit be14ba3

Browse files
committed
B2B-1876: New directories in pub/media do not get synced back to local filesystem from S3 Remote Storage
1 parent eaf688c commit be14ba3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public function getDirsCollection($path)
366366
->setCollectRecursively(false)
367367
->setOrder('basename', \Magento\Framework\Data\Collection\Filesystem::SORT_ORDER_ASC);
368368

369-
if (!$this->isPathAllowed($path)) {
369+
if (!$this->isDirectoryAllowed($path)) {
370370
$collection->setDirsFilter($this->getAllowedDirMask($path));
371371
}
372372

@@ -486,7 +486,7 @@ public function createDirectory($name, $path)
486486
);
487487
}
488488

489-
if (!($this->isPathAllowed(rtrim($path, '/') . '/' . $name))) {
489+
if (!($this->isDirectoryAllowed(rtrim($path, '/') . '/' . $name))) {
490490
throw new \Magento\Framework\Exception\LocalizedException(
491491
__('We cannot create the folder under the selected directory.')
492492
);
@@ -533,7 +533,7 @@ public function createDirectory($name, $path)
533533
*/
534534
public function deleteDirectory($path)
535535
{
536-
if (!$this->isPathAllowed(dirname($path))) {
536+
if (!$this->isDirectoryAllowed(dirname($path))) {
537537
throw new \Magento\Framework\Exception\LocalizedException(
538538
__('We cannot delete the selected directory.')
539539
);
@@ -582,7 +582,7 @@ protected function _deleteByPath($path)
582582
*/
583583
public function deleteFile($target)
584584
{
585-
if (!$this->isPathAllowed(dirname($target))) {
585+
if (!$this->isDirectoryAllowed(dirname($target))) {
586586
throw new \Magento\Framework\Exception\LocalizedException(
587587
__('We can\'t delete the file right now.')
588588
);
@@ -614,7 +614,7 @@ public function deleteFile($target)
614614
*/
615615
public function uploadFile($targetPath, $type = null)
616616
{
617-
if (!($this->isPathAllowed($targetPath))) {
617+
if (!($this->isDirectoryAllowed($targetPath))) {
618618
throw new \Magento\Framework\Exception\LocalizedException(
619619
__('We can\'t upload the file to the current folder right now. Please try another folder.')
620620
);
@@ -966,16 +966,16 @@ private function getExtensionsList($type = null): array
966966
}
967967

968968
/**
969-
* Check if path is allowed
969+
* Check if directory is allowed
970970
*
971-
* @param string $path Absolute path
971+
* @param string $directoryPath Absolute path to a directory
972972
* @return bool
973973
*/
974-
private function isPathAllowed($path): bool
974+
private function isDirectoryAllowed($directoryPath): bool
975975
{
976976
$storageRoot = $this->_cmsWysiwygImages->getStorageRoot();
977977
$storageRootLength = strlen($storageRoot);
978-
$mediaSubPathname = substr($path, $storageRootLength);
978+
$mediaSubPathname = substr($directoryPath, $storageRootLength);
979979
if (!$mediaSubPathname) {
980980
return false;
981981
}

0 commit comments

Comments
 (0)