Skip to content

Commit f0e6870

Browse files
committed
ACP2E-3854: Bundled/Merged JS not part of SRI Hashes
1 parent 770a8de commit f0e6870

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

app/code/Magento/Csp/Plugin/GenerateBundleAssetIntegrity.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Framework\App\Filesystem\DirectoryList;
1515
use Magento\Framework\Exception\FileSystemException;
1616
use Magento\Framework\Filesystem;
17+
use Magento\Framework\Filesystem\Io\File;
1718

1819
class GenerateBundleAssetIntegrity
1920
{
@@ -37,22 +38,30 @@ class GenerateBundleAssetIntegrity
3738
*/
3839
private Filesystem $filesystem;
3940

41+
/**
42+
* @var File
43+
*/
44+
private File $fileIo;
45+
4046
/**
4147
* @param HashGenerator $hashGenerator
4248
* @param SubresourceIntegrityFactory $integrityFactory
4349
* @param SubresourceIntegrityCollector $integrityCollector
4450
* @param Filesystem $filesystem
51+
* @param File $fileIo
4552
*/
4653
public function __construct(
4754
HashGenerator $hashGenerator,
4855
SubresourceIntegrityFactory $integrityFactory,
4956
SubresourceIntegrityCollector $integrityCollector,
50-
Filesystem $filesystem
57+
Filesystem $filesystem,
58+
File $fileIo,
5159
) {
5260
$this->hashGenerator = $hashGenerator;
5361
$this->integrityFactory = $integrityFactory;
5462
$this->integrityCollector = $integrityCollector;
5563
$this->filesystem = $filesystem;
64+
$this->fileIo = $fileIo;
5665
}
5766

5867
/**
@@ -82,7 +91,7 @@ public function afterDeploy(Bundle $subject, ?string $result, string $area, stri
8291
$pubStaticDir->readFile($file)
8392
),
8493
'path' => $area . '/' . $theme . '/' . $locale .
85-
"/" . Bundle::BUNDLE_JS_DIR . '/' . pathinfo($file)['basename']
94+
"/" . Bundle::BUNDLE_JS_DIR . '/' . $this->fileIo->getPathInfo($file)['basename']
8695
]
8796
]
8897
);

0 commit comments

Comments
 (0)