Skip to content

Commit 43a749a

Browse files
committed
B2B-1876: New directories in pub/media do not get synced back to local filesystem from S3 Remote Storage
- address code review comment
1 parent 84e8f8d commit 43a749a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

app/code/Magento/RemoteStorage/Model/Filesystem/Directory/WriteFactory.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\RemoteStorage\Model\Filesystem\Directory;
77

8+
use Magento\Framework\Filesystem\Directory\CompositePathValidator;
9+
use Magento\Framework\Filesystem\Directory\DenyListPathValidator;
810
use Magento\Framework\Filesystem\Directory\PathValidator;
911
use Magento\Framework\Filesystem\Directory\WriteFactory as BaseWriteFactory;
1012
use Magento\RemoteStorage\Driver\DriverPool;
@@ -54,14 +56,21 @@ public function create($path, $driverCode = DriverPool::REMOTE, $createPermissio
5456
$factory = new \Magento\Framework\Filesystem\File\WriteFactory(
5557
$this->driverPool
5658
);
59+
60+
$validators = [
61+
'pathValidator' => new PathValidator($driver),
62+
'denyListPathValidator' => new DenyListPathValidator($driver)
63+
];
64+
65+
$pathValidator = new CompositePathValidator($validators);
5766
return $this->objectManager->create(
5867
Write::class,
5968
[
6069
'fileFactory' => $factory,
6170
'driver' => $driver,
6271
'path' => $path,
6372
'createPermissions' => $createPermissions,
64-
'pathValidator' => new PathValidator($driver),
73+
'pathValidator' => $pathValidator
6574
]
6675
);
6776
} else {

app/code/Magento/RemoteStorage/etc/di.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
<argument name="driverPool" xsi:type="object">Magento\RemoteStorage\Driver\DriverPool</argument>
2121
</arguments>
2222
</virtualType>
23+
<type name="Magento\Framework\Filesystem\Directory\ReadFactory">
24+
<arguments>
25+
<argument name="driverPool" xsi:type="object">Magento\RemoteStorage\Driver\DriverPool</argument>
26+
</arguments>
27+
</type>
2328
<type name="Magento\RemoteStorage\Filesystem">
2429
<arguments>
2530
<argument name="writeFactory" xsi:type="object">
2631
Magento\RemoteStorage\Model\Filesystem\Directory\WriteFactory
2732
</argument>
28-
<argument name="readFactory" xsi:type="object">remoteReadFactory</argument>
2933
</arguments>
3034
</type>
3135
<virtualType name="customRemoteFilesystem" type="Magento\RemoteStorage\Filesystem">

0 commit comments

Comments
 (0)