Skip to content

Commit b293437

Browse files
author
Peter O'Callaghan
committed
Fix potentially corrupt merged CSS files.
Create temporary files in the same static directory as the target file to ensure that both files are on the same filesystem and thus the call to rename will be atomic. This resolves #29172.
1 parent cc7f549 commit b293437

File tree

1 file changed

+2
-3
lines changed
  • lib/internal/Magento/Framework/View/Asset/MergeStrategy

1 file changed

+2
-3
lines changed

lib/internal/Magento/Framework/View/Asset/MergeStrategy/Direct.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ public function merge(array $assetsToMerge, Asset\LocalInterface $resultAsset)
6161
$filePath = $resultAsset->getPath();
6262
$tmpFilePath = $filePath . $this->mathRandom->getUniqueHash('_');
6363
$staticDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
64-
$tmpDir = $this->filesystem->getDirectoryWrite(DirectoryList::TMP);
65-
$tmpDir->writeFile($tmpFilePath, $mergedContent);
66-
$tmpDir->renameFile($tmpFilePath, $filePath, $staticDir);
64+
$staticDir->writeFile($tmpFilePath, $mergedContent);
65+
$staticDir->renameFile($tmpFilePath, $filePath, $staticDir);
6766
}
6867

6968
/**

0 commit comments

Comments
 (0)