Skip to content

Commit c068774

Browse files
committed
B2B- 1789: The first Request For Storefront Image After Deleting Local File System Cached Images Results In Magento Placeholder Image When Using S3
1 parent 39e1300 commit c068774

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

app/code/Magento/Backend/Test/Mftf/Helper/CurlHelpers.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ public function assertImageContentIsEqual(
5757
): void {
5858
$cookie = $this->getCookie($cookieName);
5959
$imageContent = $this->getCurlResponse($url, $cookie, $postBody);
60-
// Must make request twice until bug is resolved: B2B-1789
61-
$imageContent = $this->getCurlResponse($url, $cookie, $postBody);
6260
// md5() here is not for cryptographic use.
6361
// phpcs:ignore Magento2.Security.InsecureFunction
6462
$imageContentMD5 = md5($imageContent);

app/code/Magento/MediaStorage/App/Media.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,18 @@ public function launch(): ResponseInterface
216216
*/
217217
private function createLocalCopy(): void
218218
{
219-
$this->syncFactory->create(['directory' => $this->directoryPub])
220-
->synchronize($this->relativeFileName);
219+
$synchronizer = $this->syncFactory->create(['directory' => $this->directoryPub]);
220+
$synchronizer->synchronize($this->relativeFileName);
221221

222222
if ($this->directoryPub->isReadable($this->relativeFileName)) {
223223
return;
224224
}
225225

226226
if ($this->mediaUrlFormat === CatalogMediaConfig::HASH) {
227227
$this->imageResize->resizeFromImageName($this->getOriginalImage($this->relativeFileName));
228+
if (!$this->directoryPub->isReadable($this->relativeFileName)) {
229+
$synchronizer->synchronize($this->relativeFileName);
230+
}
228231
}
229232
}
230233

0 commit comments

Comments
 (0)