Created
June 18, 2020 01:40
-
-
Save mpchadwick/a0a18775e99a3f112f257b53db7a6075 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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