Arkade\S3\Helper\MediaStorage\File\Storage\Database\Plugin::afterGetMediaRelativePath PHP Метод

afterGetMediaRelativePath() публичный Метод

The Magento_ImportExport module will try to run erroneous file paths, e.g. pub/media/catalog/category/twswifty.jpg, through the parent function of this plugin. The parent function can't handle this so it just returns the original file path (when we really don't want the pub/media prefix at all). This plugin will remove the pub/media prefix.
public afterGetMediaRelativePath ( Magento\MediaStorage\Helper\File\Storage\Database $subject, string $result ) : string
$subject Magento\MediaStorage\Helper\File\Storage\Database
$result string
Результат string
    public function afterGetMediaRelativePath(Database $subject, $result)
    {
        $newMediaRelativePath = $result;
        if ($this->helper->checkS3Usage()) {
            $prefixToRemove = 'pub/media/';
            if (substr($result, 0, strlen($prefixToRemove)) == $prefixToRemove) {
                $newMediaRelativePath = substr($result, strlen($prefixToRemove));
            }
        }
        return $newMediaRelativePath;
    }