Skip to content

Commit

Permalink
Remove store code in image path for category (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandrsKondratjevs authored Dec 28, 2020
1 parent d21ef8d commit 335866f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Model/Resolver/Category/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\UrlInterface;
use Magento\Store\Api\Data\StoreInterface;
use Magento\Framework\Filesystem\DirectoryList;
use Magento\Catalog\Model\Category\FileInfo;
Expand Down Expand Up @@ -55,7 +56,7 @@ public function resolve(

/** @var StoreInterface $store */
$store = $context->getExtensionAttributes()->getStore();
$baseUrl = $store->getBaseUrl();
$baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_DIRECT_LINK);

$filenameWithMedia = $this->fileInfo->isBeginsWithMediaDirectoryPath($imagePath)
? $imagePath : $this->formatFileNameWithMediaCategoryFolder($imagePath);
Expand All @@ -82,4 +83,4 @@ protected function formatFileNameWithMediaCategoryFolder(string $fileName): stri
. '/'
. $baseFileName;
}
}
}

0 comments on commit 335866f

Please sign in to comment.