diff --git a/vendor/magento/module-media-storage/App/Media.php b/vendor/magento/module-media-storage/App/Media.php | |
index e1644ebaf5a..5993deecfd2 100644 | |
--- a/vendor/magento/module-media-storage/App/Media.php | |
+++ b/vendor/magento/module-media-storage/App/Media.php | |
@@ -141,10 +141,10 @@ class Media implements AppInterface | |
{ | |
$this->appState->setAreaCode(Area::AREA_GLOBAL); | |
- if ($this->mediaDirectoryPath !== $this->directory->getAbsolutePath()) { | |
+ $config = $this->configFactory->create(['cacheFile' => $this->configCacheFile]); | |
+ if (!$this->comparePaths($this->mediaDirectoryPath, $config->getMediaDirectory())) { | |
// Path to media directory changed or absent - update the config | |
/** @var Config $config */ | |
- $config = $this->configFactory->create(['cacheFile' => $this->configCacheFile]); | |
$config->save(); | |
$this->mediaDirectoryPath = $config->getMediaDirectory(); | |
$allowedResources = $config->getAllowedResources(); | |
@@ -171,6 +171,18 @@ class Media implements AppInterface | |
return $this->response; | |
} | |
+ /** | |
+ * @param string $path1 | |
+ * @param string $path2 | |
+ * @return bool | |
+ */ | |
+ private function comparePaths($path1, $path2) | |
+ { | |
+ if (rtrim($path1, '/') == rtrim($path2, '/')) | |
+ return true; | |
+ return false; | |
+ } | |
+ | |
private function setPlaceholderImage() | |
{ | |
$placeholder = $this->placeholderFactory->create(['type' => 'image']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment