Skip to content

Commit 6a490a8

Browse files
#15588 Fixed incorrect image urls in multistore xml sitemap
placed the stop Emulation in a finally. Now it will always be executed.
1 parent 83ad777 commit 6a490a8

File tree

1 file changed

+3
-1
lines changed
  • app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap

1 file changed

+3
-1
lines changed

app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap/Generate.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function execute()
4343
$sitemap->load($id);
4444
// if sitemap record exists
4545
if ($sitemap->getId()) {
46+
4647
try {
4748
//We need to emulate to get the correct frontend URL for the product images
4849
$this->appEmulation->startEnvironmentEmulation(
@@ -51,7 +52,6 @@ public function execute()
5152
true
5253
);
5354
$sitemap->generateXml();
54-
$this->appEmulation->stopEnvironmentEmulation();
5555

5656
$this->messageManager->addSuccess(
5757
__('The sitemap "%1" has been generated.', $sitemap->getSitemapFilename())
@@ -60,6 +60,8 @@ public function execute()
6060
$this->messageManager->addError($e->getMessage());
6161
} catch (\Exception $e) {
6262
$this->messageManager->addException($e, __('We can\'t generate the sitemap right now.'));
63+
} finally {
64+
$this->appEmulation->stopEnvironmentEmulation();
6365
}
6466
} else {
6567
$this->messageManager->addError(__('We can\'t find a sitemap to generate.'));

0 commit comments

Comments
 (0)